Cron jobs running 6 hours late? // Fixed - cron needed restarting

7 posts / 0 new
Last post
#1 Mon, 04/23/2012 - 20:59
Brook

Cron jobs running 6 hours late? // Fixed - cron needed restarting

I've set up some backups to be carried out via some cron jobs, but have noticed they are running 6 hours later.

The server time is correct, and is confirmed by 'date', but the cron jobs are running late - any ideas why that might be happening?

Mon, 04/23/2012 - 22:15
andreychek

Where are you seeing the time as being 6 hours late?

Where ever it is that you're seeing that time, is the timezone correct?

Also, you may want to look in your logs, which will show exactly when a cron job is being launched; that may offer some clues as to what's going on.

-Eric

Tue, 04/24/2012 - 08:31
Brook

Hi Eric

I first noticed the time when I looked at the time/date on the sql files, and also my users posted about it in our forums and noted down the exact time - which matches the time I see on the back up files (which is exactly 6 hours behind the time set in the cron-job).

Which logs do I need to look at?

If I go to Webmin > hardware > system time it is showing the correct time for both software/hardware... which is why it's so odd :/

Tue, 04/24/2012 - 09:07
andreychek

Which log files depends on your distro... what distro/version are you using there?

-Eric

Tue, 04/24/2012 - 10:07
Brook

Hi Eric, I'm using CentOS 5.8

Tue, 04/24/2012 - 11:38
andreychek

Okay, on CentOS, you should be able to see the Cron logs in /var/log/cron.

In there, you should see when the cron job was launched, as well as if there were any problems.

Do you see anything unusual in there?

Tue, 04/24/2012 - 14:30
Brook

It's showing all crons (even the one's that were set-up by the default install) running exactly 6 hours late.

I have set the server time to GMT (Europe/London) not sure if that has something to do with it and the cron is getting the time from somewhere else?

Edit:
Running: crontab -l

Shows my correct times (last 5 lines):


2 22 * * * /etc/webmin/virtual-server/sendratings.pl
4,9,14,19,24,29,34,39,44,49,54,59 * * * * /etc/webmin/virtual-server/collectinfo.pl
43 16 * * * /etc/webmin/virtual-server/scriptlatest.pl
0,5,10,15,20,25,30,35,40,45,50,55 * * * * /etc/webmin/status/monitor.pl
11 * * * * /etc/webmin/virtual-server/spamconfig.pl
47 2 * * * /home/mysite/myscripts/backup_script_gs.sh
50 0 * * * /home/mysite/myscripts/backup_script_cs.sh
41 2 * * * /home/mysite/myscripts/backup_script_ds.sh
15 1 * * * /home/mysite/myscripts/backup_script_yop.sh
30 0 * * * /home/mysite/myscripts/backup_script_50.sh

But for some reason they are running 6 hours late - a really odd bug.

Edit2: I've read that you should restart cron after changing the sys time, so I have done that... and it seems to be working now :D

Topic locked