1

We have a system configured in local UK time - so its currently in BST and will be switching to GMT this coming weekend.

There are some reports scheduled with cron that are for users in Hong Kong. As they have no Daylight Savings Time, their clocks are not changing.

So - the plan is, as per usual, to adjust the times of their reports back an hour.

Is there a way to tell cron to run at a specific timezone time, for example run job1 at 9am localtime, run job2 at 10am HK time?

I see from this question that you can specify a timezone in the crontab file, but that seems to affect the timezone of the environment under which commands are run and not the time at which the jobs are run.

Thanks in advance for any tips. Chris

Chris Kimpton
  • 713
  • 9
  • 18
  • Considered Autosys, but seems overkill for this small annoyance. Currently going for a templated crontab file - expanding GMT08 etc type tokens for the correct time. Still requires a release per cutover, but less error prone – Chris Kimpton Oct 25 '11 at 14:36

1 Answers1

1

Sure, you can. Try this:

0 9 * * * job1
TZ=Asia/Hong_Kong
0 10 * * * job2
quanta
  • 50,327
  • 19
  • 152
  • 213
  • 1
    Thanks quanta, I did try that out, but that just means within job2 the timezone is Hong Kong, it still gets triggered at 10am BST. I want it to run at 10am Hong Kong time. – Chris Kimpton Oct 24 '11 at 17:45