Date: Sun, 24 May 2009 18:45:38 -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: <ade45ae90905241745n7980c44ci9455ff2bb482bb2f@mail.gmail.com> In-Reply-To: <1243207862.11905.0.camel@ubuntu> References: <1243136795.29198.42.camel@ubuntu> <ade45ae90905232241g5d17d9ccnb19bdd164a6252d@mail.gmail.com> <1243207862.11905.0.camel@ubuntu>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, May 24, 2009 at 5:31 PM, GT <catch.all@marketmentat.com> wrote: > On Sat, 2009-05-23 at 23:41 -0600, Tim Judd wrote: > > > <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. > > > > Yep - I understood that, Tim. > > Thew issue seems to be that cron pays no attention to TZ declarations > that happen AFTER it wakes up - cron does not parse the job times using > the new TZ. > > The thing I am struggling with is that 'date' picks up the changes > imposed by 'TZ=', but then 'cron' parses the next line as if the job > times are interpreted using the server's default TZ. > > I've tried using 'CRON_TZ=' as well as, and instead of, 'TZ=' - to no > avail. > > > What I thought ought to happen is this: > > * 'cron' wakes up; > * 'cron' works through the crontab line by line; > * at line 1 cron changes the TZ to America/NY; > * at line 2 cron reads the job time in the context of having just been > told that it's operating in the NY timezone (thus 45 13 * * * is 1:45 pm > NY time); > . > . > . > * at line 15 cron is told to change the TZ to Australia/Sydney; > * from line 14 onwards, 45 13 * * * is 1:45 pm SYDNEY time. > . > . > . > and so on. > > > > It seems that cron behaves as if it forgets $TZ at each newline within a > given cron instance. > > The silly thing is, with all the time I've wasted pursuing this wild > goose I could have built the required four crontabs, and written the > script to swap them in and out on the appropriate dates. > > (Or I could have spent $100 and bought a shared-hosted server space to > do the Australian-TZ stuff and given it sufficent permission to store > the resultant data in y primary mySQL db...) > > Still, I think it's worth persevering with. I'm certain it can be done. > > > You might want to try some other determining factor, such as a shell > > builtin. > > > > > > Good luck. > > Cheers > How about a jail for America/NY, and a jail for AU/Sydney? that might work. --TJ
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?ade45ae90905241745n7980c44ci9455ff2bb482bb2f>