Problem with Cronjobs timing

duzap

Verified User
Joined
Nov 14, 2008
Messages
41
Hello guys,
I did set a cronjob in this way:

Minute Hour Day of Month Month Day of Week
0 5 * * *

I want the cronjob to run at 5:00AM,
But somehow and I really don't understand WHY, the cronjob is done at 12:00PM.

My server time is fine,
I did set it by rdate -s time-a.nist.gov and /sbin/hwclock --systohc
when I type "date", the time is correct.
My timezone is also correct, I configured it with "system-config-time" (I am using CentOS 5.4)

What is the problem and how should I fix it?
Thanks.
 
Last edited:
Does the cron log say it ran at 12pm?

Check the output of: crontab -u <username> -l
 
output of crontab -u <username> -l:
0 5 * * * /home/user/script.sh

Crontab log:
Feb 26 12:00:01 server crond[1042]: (root) CMD (/usr/local/directadmin/dataskq)
Feb 26 12:00:01 server crond[1043]: (user) CMD (/home/user/script.sh)
Feb 26 12:01:01 server crond[1160]: (root) CMD (run-parts /etc/cron.hourly)

As you can see, crontab thinks differently.
It does happen like this everyday at 12:00PM.
 
Last edited:
I am guessing that the hardware time and the system time are different. I don't know the details but I am sure sure can find out by doing a google search. The date command gives you one of them. I don't know which one.
 
Yes I know it floyd,
System time is done by 'rdate -s time-a.nist.gov' and hardware time is done by '/sbin/hwclock --systohc'

I have already applied both.
 
Problem solved! :)
I just had to restart the crond service to finally apply the timezone changes.
 
Back
Top