Unix Shell - DST2007 Script Help

This is Interesting: Free IT Magazines  
Home > Archive > Unix Shell > February 2007 > DST2007 Script Help





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author DST2007 Script Help
gineraso

2007-02-22, 1:18 pm

Can anyone tell me why this script is not working? It's my Daylight
Saving workaround for my Solaris 6 server. For some reason it doesn't
change the time. Basically, at 03:01 it's suppossed to change the
time to 02:01 but it doesn't do anything. Any suggestions would be
apprecieated.

G

#Daylight saving fix
01 3 * * 0 /local/bin/daylight.saving.sh > /dev/null 2>&1

#!/bin/ksh

#Manual fix for Solaris 7 and below that corrects 2007 daylight saving
changes.

DOW=`date +%a` # Day Of Week (Sun, Mon, etc)
NDM=`date +%d` # Number of day in the Month (01, 02, etc)
MTH=`date +%b` # Month (Jan, Feb, etc)
YR=`date +%Y` # Year
ADM=xxx@email.com
MSG="Daylight saving change on $MTH $NDM, $YR failed."

#sleep 10

#Corrects original daylight saving change.

if [ "$NDM" -ge "01" -a "$NDM" -le "07" -a "$DOW" = "Sun" -a
"$MTH" = "Apr" ]
then
/usr/bin/date 0201.00
if [ $? != 0 ];then
echo $MSG|mailx -s "$MSG" $ADM
fi
fi

Bill Marcum

2007-02-22, 1:18 pm

On 22 Feb 2007 08:42:49 -0800, gineraso
<gineraso@gmail.com> wrote:
>
>
> Can anyone tell me why this script is not working? It's my Daylight
> Saving workaround for my Solaris 6 server. For some reason it doesn't
> change the time. Basically, at 03:01 it's suppossed to change the
> time to 02:01 but it doesn't do anything. Any suggestions would be
> apprecieated.
>
> G
>

I don't know why the script fails (maybe you have NTP which
automatically corrects the time), but changing the system clock to
adjust for daylight saving time is wrong. You need to modify the
timezone database. Perhaps sun.com has a timezone fix that you can
download, unless they have stopped supporting Solaris 6.

apropos "time zone"


--
Remembering is for those who have forgotten.
-- Chinese proverb
Glenn Jackman

2007-02-22, 7:15 pm

At 2007-02-22 11:42AM, "gineraso" wrote:
> Can anyone tell me why this script is not working? It's my Daylight
> Saving workaround for my Solaris 6 server. For some reason it doesn't
> change the time. Basically, at 03:01 it's suppossed to change the
> time to 02:01 but it doesn't do anything. Any suggestions would be
> apprecieated.
>
> G
>
> #Daylight saving fix
> 01 3 * * 0 /local/bin/daylight.saving.sh > /dev/null 2>&1
>
> #!/bin/ksh
>
> #Manual fix for Solaris 7 and below that corrects 2007 daylight saving
> changes.
>
> DOW=`date +%a` # Day Of Week (Sun, Mon, etc)
> NDM=`date +%d` # Number of day in the Month (01, 02, etc)
> MTH=`date +%b` # Month (Jan, Feb, etc)
> YR=`date +%Y` # Year
> ADM=xxx@email.com
> MSG="Daylight saving change on $MTH $NDM, $YR failed."
>
> #sleep 10
>
> #Corrects original daylight saving change.
>
> if [ "$NDM" -ge "01" -a "$NDM" -le "07" -a "$DOW" = "Sun" -a
> "$MTH" = "Apr" ]
> then
> /usr/bin/date 0201.00
> if [ $? != 0 ];then
> echo $MSG|mailx -s "$MSG" $ADM
> fi
> fi


Not answering your question, but aren't you setting yourself up for an
"infinite loop" of time zone resets? That 3:01 cron event is going to
trigger every hour if you push the system clock back.

You have to delete the script, change the crontab, or set some flag to
indicate that you've already reset the clock.

Or perhaps "Groundhog Day" is your favourite movie ;)


--
Glenn Jackman
"You can only be young once. But you can always be immature." -- Dave Barry
gineraso

2007-02-28, 7:17 pm

On Feb 22, 2:54 pm, Glenn Jackman <gle...@ncf.ca> wrote:
> At 2007-02-22 11:42AM, "gineraso" wrote:
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> Not answering your question, but aren't you setting yourself up for an
> "infinite loop" of time zone resets? That 3:01 cron event is going to
> trigger every hour if you push the system clock back.
>
> You have to delete the script, change the crontab, or set some flag to
> indicate that you've already reset the clock.
>
> Or perhaps "Groundhog Day" is your favourite movie ;)
>
> --
> Glenn Jackman
> "You can only be young once. But you can always be immature." -- Dave Barry- Hide quoted text -
>
> - Show quoted text -


My Solaris servers are currently at these kernel levels. What do I
need to check to see if I'm ready for the new DST changes for 2007?


Solaris 8 108528-15
Solaris 9 118558-38
Solaris 10 118833-24

Thank you.


Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2009 webservertalk.com