Ask a Question related to Linux / Unix Administration, Design and Development.
-
hymie! #1
crontab entries for different time zones?
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! [url]http://www.smart.net/~hymowitz[/url] [email]hymie@lactose.smart.net[/email]
================================================== =============================
hymie! Guest
-
Wotrld Time Zones
Hi folks. I want to build a web page which contains a map that will display the (global) location of where each family member / school / office etc... -
scripting crontab entries
I want to be able to update a user's crontab from a script. tabs in /var/cron/tabs carry a warning that the file should not be edited directly, so... -
#21965 [Fbk->NoF]: gettext uses entries out of different files at the same time
ID: 21965 Updated by: sniper@php.net Reported By: thorsten dot kussler at communardo dot de -Status: Feedback... -
#21965 [Opn->Fbk]: gettext uses entries out of different files at the same time
ID: 21965 Updated by: sniper@php.net Reported By: thorsten dot kussler at communardo dot de -Status: Open... -
#21965 [Fbk->Opn]: gettext uses entries out of different files at the same time
ID: 21965 User updated by: thorsten dot kussler at communardo dot de Reported By: thorsten dot kussler at communardo dot de... -
Mark Rafn #2
Re: crontab entries for different time zones?
hymie! <hymie@lactose.smart.net> wrote:
Not in the way you want. The TZ var can be set in an entry, but it's>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?
passed through to the job, and has no effect on when the job runs.
Another option would be to just edit the crontab in April and November. If>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.
you want to get tricky, you can write a cron job which runs 2 hours before the
main job (only needed to run in November and April), and rewrites the crontab
if the DST has changed.
Or just move it to 1000 ET, which is the middle of the night in Hawaii and
they won't care about the one hour difference.
--
Mark Rafn [email]dagon@dagon.net[/email] <http://www.dagon.net/>
*doesn't get to wear his BOFH hat often enough*
Mark Rafn Guest
-
Birger Blixt #3
Re: crontab entries for different time zones?
On 2004-06-02 20:37, hymie! wrote:
Cron will only use one timezone, at last what I beleive.> 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! [url]http://www.smart.net/~hymowitz[/url] [email]hymie@lactose.smart.net[/email]
> ================================================== =============================
Create a cronjob that run a (write protected) script at the morning your time.
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
Birger Blixt Guest



Reply With Quote

