1

I have noticed on my RHEL 5.5 that cron daily starts an hour later (at 1AM instead of midnight). System and hardware clock are the same. How can i set it so it will start at midnight?

date

[root@a ~]# date
Wed Mar  9 12:44:35 EST 2011

hwclock

[root@a ~]# /sbin/hwclock -r
Wed 09 Mar 2011 12:44:42 PM EST  -0.000484 seconds

crontab

0 0 * * *    /usr/sbin/ntpdate pool.ntp.org >/dev/null 2>&1

cron log

Mar  7 01:00:01 host crond[30420]: (root) CMD (/usr/sbin/ntpdate pool.ntp.org >/dev/null 2>&1)

clock

[root@a ~]# cat /etc/sysconfig/clock
ZONE="America/New York"
UTC=true
ARC=false
Paxxil
  • 181
  • 1
  • 10

4 Answers4

2

Have you changed the system timezone setting? If so, did you restart the crond service afterwards?

Regardless, I would restart the cron deamon, to make sure it's using the correct timezone.

# /sbin/service crond restart
chuckx
  • 1,150
  • 6
  • 8
  • Nothing has been changed after last server restart. So the given info was the same before. And I've also tried that. – Paxxil Mar 09 '11 at 21:21
  • 1
    hum... apparently there have been some changes made by my coworker. After server restart it seems to work now. Only crond restart was not enough. – Paxxil Mar 09 '11 at 21:40
1

It is not always "enough" to restart crond.

  1. set /etc/localtime as symlink to link with one of /usr/share/zoneinfo/... time zone file
  2. set /etc/sysconfig/clock to ZONE="CONTINENT/TOWN" (+ UTC=true and ARC=false)
  3. restart the whole machine
Felix Frank
  • 3,093
  • 1
  • 16
  • 22
Luc-Olivier
  • 111
  • 4
0

IHMO, there's nothing wrong with daily cron jobs running at 1:00 am, as long as they run daily.

Check your /etc/crontab file, mine (RHEL 5.4) runs at 2:00 am by default:

# run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly

Look for your the cron.daily line. Edit to suit, e.g.:

01 0 * * * root run-parts /etc/cron.daily
JeffG
  • 1,194
  • 6
  • 18
0

If you are talking about things running out of /etc/cron.daily, those are defined in /etc/crontab. Make sure the entry for /etc/cron.daily is set to run at midnight, by default it runs at 04:02.

Alex
  • 6,603
  • 1
  • 24
  • 32