cron doesn't change schedule when system time is changed

Bug #274631 reported by Gary
4
Affects Status Importance Assigned to Milestone
cron (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: cron

When the system time is changed, the cron schedule does not update. It continues to run as if the time had not been updated, until the system is rebooted.

To reproduce:
- Set a cron job to occur 5 minutes after the current time
- Change the system time to something different, so the cron job shouldn't occur in 5 minutes
- Observe the cron job occurring when it shouldn't be

$ lsb_release -rd
Description: Ubuntu 8.04.1
Release: 8.04

$ apt-cache policy cron
cron:
  Installed: 3.0pl1-100ubuntu2
  Candidate: 3.0pl1-100ubuntu2
  Version table:
 *** 3.0pl1-100ubuntu2 0
        500 http://archive.ubuntu.com hardy/main Packages
        100 /var/lib/dpkg/status

Revision history for this message
datanalytics.com (cgb-datanalytics) wrote :

Hello,

Have you taken into consideration the comments on cron's man file concerning "hour changes"? I copy from my file below:

"Special considerations exist when the clock is changed by less than 3 hours, for example at the beginning and end of daylight savings time. If the time has moved forwards, those jobs which would have run in the time that was skipped will be run soon after the change. Conversely, if the time has moved backwards by less than 3 hours, those jobs that fall into the repeated time will not be re-run.

Only jobs that run at a particular time (not specified as @hourly, nor with ’*’ in the hour or minute specifier) are affected. Jobs which are specified with wildcards are run based on the new time immediately.

Clock changes of more than 3 hours are considered to be corrections to the clock, and the new time is used immediately."

Would it be the case that your test has interferred with this rule? By how many hours have you changed the clock?

Revision history for this message
Gary (pento) wrote :

I moved the clock back 8 hours. To give the example from my system, I have a cron job set to run daily at 4am. At ~2am, I set the clock back 8 hours and left the computer running. The job still ran two hours later, though. After rebooting it ran at the normal time, I didn't check to see if it would run at the wrong time again.

Revision history for this message
datanalytics.com (cgb-datanalytics) wrote :

Could it be a "timezones" problem? Can you have a look at this discussion here:

http://www.experts-exchange.com/OS/Linux/Distributions/Red_Hat/Q_22977697.html

?

It seems that date and cron do not necessarily see the same time...

Revision history for this message
Gary (pento) wrote :

It doesn't seem to be the same, though I don't have an experts-exchange account to read all the comments.

When I reboot, the problem goes away, cron syncs up to be running at the correct time according to the system clock. It seems that the problem is that cron isn't recognising when the system time changes until reboot.

Revision history for this message
Jamie Strandboge (jdstrand) wrote :

The Debian maintainer contacted me and mentioned that this bug should be fixed in Debian unstable. I have performed a merge and uploaded cron_3.0pl1-113ubuntu1 to our development release (Ubuntu 10.10).

Gary, can you verify if this is fixed in Ubuntu 10.10.

Changed in cron (Ubuntu):
assignee: nobody → Jamie Strandboge (jdstrand)
status: New → Incomplete
Changed in cron (Ubuntu):
assignee: Jamie Strandboge (jdstrand) → nobody
status: Incomplete → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.