Re: [CentOS-pt-br] Horário de verão

Guilherme Rocha guilhermedulong em gmail.com
Terça Outubro 14 19:57:04 UTC 2008


E ae Michelangelo,

segue abaixo o script que usei...

#!/bin/bash
ANO_INICIO="2008" #Ano que inicia o Horario de verao
ANO_FIM="2009" #Ano que finaliza o Horario de verao
DIA_INICIO="Oct 19" #Mes (abreviado em Ingles) e dia que inicia o horário de
verão
DIA_FIM="Feb 15" #Mes (abreviado em Ingles) e dia que finaliza o horário de
verão
RM=$(which rm)
CP=$(which cp)
BIN=$(which zic)
ZDUMP=$(which zdump)
MD5BIN=$(which md5sum)
SERVICE=$(which service)
ZIC=/usr/share/zoneinfo/Brazil/verao.$ANO_INICIO-$ANO_FIM.zic
EAST=/usr/share/zoneinfo/Brazil/East
LOCALTIME=/etc/localtime
echo -ne "\nVerificando a existencia do programa $BIN"
if [ -x $BIN ] ; then
      echo -ne "\t\t\t\t\E[32m[ OK ]\n" ; tput sgr0
else
      echo -ne "\t\t\t\t\E[31m[ERRO]\n" ; tput sgr0
      exit
fi
echo -ne "\nCriando o arquivo de  configurações do horário de verão
$ANO_INICIO-$ANO_FIM"
cat > $ZIC << EOF
Rule Brazil $ANO_INICIO only - $DIA_INICIO 00:00 1 S
Rule Brazil $ANO_FIM only - $DIA_FIM 00:00 0 -
Zone Brazil/East -3:00 Brazil BR%sT
EOF
SAIDA=$?
if [ $SAIDA = 0 ] ;then
      echo -ne "\t\t\E[32m[ OK ]\n" ; tput sgr0
else
      echo -ne "\t\t\E[31m[ERRO]\n" ; tput sgr0
      exit
fi
echo -ne "\nCriando o binário com as informações do horário de verão
$ANO_INICIO-$ANO_FIM"
if $BIN $ZIC ;then
      echo -ne "\t\t\E[32m[ OK ]\n" ; tput sgr0
else
      echo -ne "\t\t\E[31m[ERRO]\n" ; tput sgr0
      exit
fi
echo -ne "\nRemovendo informações do horário de verão antigo"
if $RM $LOCALTIME ;then
      echo -ne "\t\t\t\t\E[32m[ OK ]\n" ; tput sgr0
else
      echo -ne "\t\t\t\t\E[31m[ERRO]\n" ; tput sgr0
      exit
fi
echo -ne "\nAtivando as configurações para o horário de verão
$ANO_INICIO-$ANO_FIM"
if $CP $EAST $LOCALTIME ;then
      echo -ne "\t\t\t\E[32m[ OK ]\n" ; tput sgr0
else
      echo -ne "\t\t\t\E[31m[ERRO]\n" ; tput sgr0
      exit
fi
echo -ne "\nVerificando o status da ativação"
GREP=`echo $ANO_INICIO | cut -c 4``echo $ANO_FIM | cut -c 4`
DUMP=`zdump -v Brazil/East |grep 200[$GREP] | wc -l`
if [ "$DUMP" == "4" ] ; then
      echo -ne "\t\t\t\t\t\t\E[32m[ OK ]\n" ; tput sgr0
else
      echo -ne "\t\t\t\t\t\t\E[31m[ERRO]\n" ; tput sgr0
      exit
fi
echo -ne "\nReiniciando o crontab\n\n"
$SERVICE crond restart


espero que ajude..

abraço

2008/10/14 Michelangelo <centos em michelangelo.com.br>

> Aqui não vai mesmo... vc poderia postar o script?
>
> Muito obrigado.
>
>  Alan;
>
> ----- Mensagem original -----
> De: "Guilherme Rocha" <guilhermedulong em gmail.com>
> Para: "Portuguese (Brazilian) CentOS mailing list" <
> centos-pt-br em centos.org>
> Enviadas: Terça-feira, 14 de Outubro de 2008 17:33:46 (GMT-0300)
> Auto-Detected
> Assunto: Re: [CentOS-pt-br] Horário de verão
>
> bom, eu não usei a atualização, eu usei um script para atualizar.
> 2008/10/14 Michelangelo > Obrigado Guilherme! > > Atualizei o vzdata pelo
> comando #yum update vzdata e ele ficou com a > versão: > > [root em XXX ~]#
> rpm -qa |grep tz > tzdata-2008e-1.el4 > > Mas o horário aparentemente não
> atualizou: > > [root em XXX ~]# zdump -v Brazil/East |grep 2008 > Brazil/East
> Sun Feb 17 01:59:59 2008 UTC = Sat Feb 16 23:59:59 2008 BRST > isdst=1
> gmtoff=-7200 > Brazil/East Sun Feb 17 02:00:00 2008 UTC = Sat Feb 16
> 23:00:00 2008 BRT > isdst=0 gmtoff=-10800 > Brazil/East Sun Oct 12 02:59:59
> 2008 UTC = Sat Oct 11 23:59:59 2008 BRT > isdst=0 gmtoff=-10800 >
> Brazil/East Sun Oct 12 03:00:00 2008 UTC = Sun Oct 12 01:00:00 2008 BRST >
> isdst=1 gmtoff=-7200 > > Será que to fazendo algo de errado? > > Alan; > > >
> ----- Mensagem original ----- > De: "Guilherme Rocha" > Para: "Portuguese
> (Brazilian) CentOS mailing list" < > centos-pt-br em centos.org> > Enviadas:
> Terça-feira, 14 de Outubro de 2008 14:50:18 (GMT-0300) > Auto-Detected >
> Assunto: Re: [CentOS-pt-br] Horário de verão > > E ae meu amigo.. zdump -v
> Brazil/East | grep 200[89] esse comando deve > funcionar 2008/10/14
> Michelangelo > Muito obrigado Jayson, aproveitando > depois de atualizar o
> tzdata como faço > pra ver as datas programadas para o > horario de verão
> entrar em vigor? > > Alan; > > > ----- Mensagem original > ----- > De:
> "Jayson Santos dos Reis" > Para: "Portuguese (Brazilian) CentOS > mailing
> list" < > centos-pt-br em centos.org> > Enviadas: Terça-feira, 14 de >
> Outubro de 2008 12:56:54 (GMT-0300) > Auto-Detected > Assunto: Re: >
> [CentOS-pt-br] Horário de verão > > Olá Alan, Apenas atualize seu sistema, >
> foi disponibilizado a atualização do > tzdata. Abraço Jayson Em Ter, >
> 2008-10-14 às 12:14 -0200, Michelangelo > escreveu: > Olá pessoal! > > Tenho
> > todos os meus servidores com o centos 4 > rodando, e gostaria de > saber >
> qual a melhor maneira de alterar o horario de > verão em todos > eles, >
> obrigado! > > > Alan; > > > > > >
> _______________________________________________ > CentOS-pt-br mailing list
> > > > CentOS-pt-br em centos.org > > >
> http://lists.centos.org/mailman/listinfo/centos-pt-br > >
> _______________________________________________ CentOS-pt-br mailing list >
> > CentOS-pt-br em centos.org > >
> http://lists.centos.org/mailman/listinfo/centos-pt-br > > >
> _______________________________________________ > CentOS-pt-br mailing list
> > > CentOS-pt-br em centos.org > >
> http://lists.centos.org/mailman/listinfo/centos-pt-br > > >
> _______________________________________________ CentOS-pt-br mailing list >
> CentOS-pt-br em centos.org >
> http://lists.centos.org/mailman/listinfo/centos-pt-br > >
> _______________________________________________ > CentOS-pt-br mailing list
> > CentOS-pt-br em centos.org >
> http://lists.centos.org/mailman/listinfo/centos-pt-br > >
> _______________________________________________ CentOS-pt-br mailing list
> CentOS-pt-br em centos.org
> http://lists.centos.org/mailman/listinfo/centos-pt-br
>
> _______________________________________________
> CentOS-pt-br mailing list
> CentOS-pt-br em centos.org
> http://lists.centos.org/mailman/listinfo/centos-pt-br
>
>
-------------- Próxima Parte ----------
Um anexo em HTML foi limpo...
URL: http://lists.centos.org/pipermail/centos-pt-br/attachments/20081014/8b16c346/attachment.htm


Mais detalhes sobre a lista de discussão CentOS-pt-br