Daylight Savings Time

Steve Losen scl at virginia.acc.virginia.edu
Fri Apr 14 06:33:35 AEST 1989


Here is a little script that we run every night with cron
just to make sure the timezone file /etc/TIMEZONE is correct.
It puts the kluge in the TIMEZONE file if the current day lies between
the first and last Sunday in April.  We run it every night because
we have a lot of machines and we don't trust them all to be up
on the two critical Sundays.


set `date`

file=/etc/TIMEZONE
line="TZ=EST5EDT; export TZ"
day=$1
month=$2
num=$3

if [ "$month" = "Apr" ] ;then

    case $day in
      Sun)  lower=0; upper=24;;
      Mon)  lower=1; upper=25;;
      Tue)  lower=2; upper=26;;
      Wed)  lower=3; upper=27;;
      Thu)  lower=4; upper=28;;
      Fri)  lower=5; upper=29;;
      Sat)  lower=6; upper=30;;
    esac

    if [ $num -gt $lower -a $num -lt $upper ] ;then
       line="TZ=EDT4; export TZ"
    fi
fi

echo "$line" > $file
-- 
Steve Losen     scl at virginia.edu
University of Virginia Academic Computing Center



More information about the Comp.sys.att mailing list