06-04-04 09:53 PM
On 2004-06-02 20:37, hymie! wrote:[vbcol=seagreen]
> Greetings.
>
> A problem has arisen at my workplace. We are near Baltimore, MD,
> GMT-5/GMT-4, and we have a customer in Honolulu, HI , GMT-10.
>
> I would like to run a cron job on my Solaris 9 box every day at 0800 HST.
> The Solaris box has EST5EDT as its default time zone. Unfortunately,
> half of the year, 0800 HST = 1400 ET, and the other half,
> 0800 HST = 1300 ET.
>
> Is there a way that I can somehow attach a TZ variable to an individual
> crontab entry?
>
> The only thing I can think of that would work is to run my job every
> day at 1300 EST/EDT , and start my script with
>
> if [ `date +%Z` = "EDT" ]
> then
> sleep 3600
> fi
>
> but the actual job is just a mv , and I was hoping to avoid building
> a script around it.
>
> Thanks.
>
> hymie! http://www.smart.net/~hymowitz hymie@lactose.smar
t.net
> ========================================
=======================================[
/v
bcol]
Cron will only use one timezone, at last what I beleive.
Create a cronjob that run a (write protected) script at the morning your tim
e.
In the script you can try:
#!/bin/sh
TZ=HST
export TZ
at 8 << EOF >/dev/null 2>&1
cd something
mv foo bar
....
EOF
Then your atjob will follow another timezone.
demo :-)
% cat htest
#!/bin/sh
TZ=HST
export TZ
at 8 << EOF
date >/tmp/htest
EOF
% ./htest
commands will be executed using /bin/tcsh
job 1086372000.a at Fri Jun 4 08:00:00 2004
% setenv TZ EST5EDT
% at -l
1086372000.a Fri Jun 4 14:00:00 2004
%
This example will run the job at 08:00:00 HST whatever the EST5EDT time is.
% zdump EST5EDT HST
EST5EDT Fri Jun 4 11:30:19 2004 EDT
HST Fri Jun 4 05:30:19 2004 HST
/bb
[ Post a follow-up to this message ]
|