7

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?

John Gardeniers
  • 27,262
  • 12
  • 53
  • 108

2 Answers2

4

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.

quanta
  • 50,327
  • 19
  • 152
  • 213
2

I had the same problem - after I changed the system's timezone, cron's log entries were in the old timezone, even after restarting crond. Then I noticed that ALL log entries were off - messages, mail, and any other programs using syslog.

service rsyslog restart

The first thing syslog does is log a message (naturally enough), so I was able to see that it had the correct timestamp. I restarted crond, just to be sure, and its log entries were correct, as well.

Win Bent
  • 21
  • 1