Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 23 May 2009 23:41:16 -0600
From:      Tim Judd <tajudd@gmail.com>
To:        Sarah.Varney@marketmentat.com
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Crontab for different ime zones
Message-ID:  <ade45ae90905232241g5d17d9ccnb19bdd164a6252d@mail.gmail.com>
In-Reply-To: <1243136795.29198.42.camel@ubuntu>
References:  <1243136795.29198.42.camel@ubuntu>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, May 23, 2009 at 9:46 PM, GT <catch.all@marketmentat.com> wrote:

> Late entry to this thread, but...
>
> I thought I had found an answer to this; at present I think I might have
> been mistaken.
>
> My crontab has about a dozen jobs that need to run in
> TZ=America/New_York, and another dozen that ideally want
> TZ=Australia/Sydney... the server default is America/Chicago.
>
> Given that the DST wobble for Australia/Sydney is not the same as for
> America/New_York (and given that I am lazy) I wanted ONE crontab that
> would serve year-round, rather than FOUR crontabs that had to be swapped
> in and out all the time (even if that could be done by a cron job).
>
> I thought I had found a solution - simply insert a line
>
>    TZ=America/New_York
>
> before the US jobs, and
>
>    TZ=Australia/Sydney
>
> before the Australian ones. A final statement to return TZ to sever
> default would be optional.
>
>
> I checked that TZ changes worked, by adding a cron job (for testing
> purposes) under each TZ declaration, of the form
>
>    TZ=America/New_York
>    * * * * * date >> /home/mysite/public_html/tmp/log.txt 2>&1
>
> and
>
>    TZ=Australia/Sydney
>    * * * * * date >> /home/mysite/public_html/tmp/log.txt 2>&1
>
<SNIP>



I propose the following:
  cron itself has no concept of timezone.  it is 'date' that is picking up
TZ and reporting as such.  Cron's job is so simple is that it wakes up each
minute to see if it has work to do, regardless of timezone, or anything
else.

You might want to try some other determining factor, such as a shell
builtin.


Good luck.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?ade45ae90905232241g5d17d9ccnb19bdd164a6252d>