We have a VDS running CentOS 5.5 that was created and configured with the EDT timezone. I have replaced etc/localtime with a link pointing to the Australia/Melbourne (UTC+10) timezone file. Running the date command displays the correct date and time.

The problem is that cron jobs are being run as if the server was still using the EDT timezone, even after a reboot. e.g. A job that should have run at 1:01AM just ran at 3:01PM.

What have I missed?

link|improve this question

Do you mean that in crontab -e you have 01 01 * * * * and it actually runs at 01 15 * * * * – Paul Sep 23 '11 at 5:50
Run date from cron and see what time zone it shows. – PaweÅ‚ Brodacki Sep 23 '11 at 5:57
@Paul, yes that's exactly what I mean. – John Gardeniers Sep 23 '11 at 8:07
@Pawel, that test revealed cron is definitely still using EDT. quanta's answer solved the problem. – John Gardeniers Sep 23 '11 at 8:18
feedback

1 Answer

up vote 1 down vote accepted

After changing the time zone, restart the crond service is enough, no need to reboot. Don't know why your cron is still using the EDT timezone, but insert a below line before your cron line:

TZ=Australia/Melbourne
* * * * * ...

and try again.

link|improve this answer
This works, although I'd still like to understand why it should even be necessary. – John Gardeniers Sep 23 '11 at 8:15
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.