NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/48648: cron fails to run job scheduled during change to summer time



>Number:         48648
>Category:       bin
>Synopsis:       cron fails to run job scheduled during change to summer time
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Mar 09 16:40:00 +0000 2014
>Originator:     Dennis Ferguson
>Release:        6.99.32
>Organization:
none at all
>Environment:
NetBSD b1.to.mistimed.ca 6.99.32 NetBSD 6.99.32 (GENERIC) #0: Wed Feb 26 
03:33:01 EST 2014  
root%b1.to.mistimed.ca@localhost:/build/amd64/obj/sys/arch/amd64/compile/GENERIC
 amd64
>Description:
The cron(1) man page says this about daylight saving time changes:

     Local time changes of less than three hours, such as those caused by the
     start or end of Daylight Saving Time, are handled specially.  This only
     applies to jobs that run at a specific time and jobs that are run with a
     granularity greater than one hour.  Jobs that run more frequently are
     scheduled normally.

     If time has moved forward, those jobs that would have run in the interval
     that has been skipped will be run immediately.  Conversely, if time has
     moved backward, care is taken to avoid running jobs twice.

This leads me to believe that a daily job scheduled to run in the
hour deleted by a change to summer time should still be run.

I have a machine with this root crontab:

#
SHELL=/bin/sh
PATH=/bin:/sbin:/usr/bin:/usr/sbin
HOME=/var/log
CRON_WITHIN=7200
#
#minute hour    mday    month   wday    command
#
*/10    *       *       *       *       /usr/libexec/atrun
#
# rotate log files every hour, if necessary
0       *       *       *       *       /usr/bin/newsyslog
#
# do daily/weekly/monthly maintenance
15      1       *       *       *       /bin/sh /etc/daily 2>&1 | tee 
/var/log/daily.out | sendmail -t
05      2       *       *       6       /bin/sh /etc/weekly 2>&1 | tee 
/var/log/weekly.out | sendmail -t
#30     5       1       *       *       /bin/sh /etc/monthly 2>&1 | tee 
/var/log/monthly.out | sendmail -t
50      2       *       *       *       /bin/sh /build/bin/b_autobuild

The job scheduled at 02:50 has run every day at that time
for the last 8 months.  From the cron(1) description I would
have expected this job to run at 03:00 instead, but cron failed
to run the job at all.  Here are the contents of /var/log/cron
across the local time change:

Mar  9 01:40:00 b1 cron[18856]: (root) CMD START (/usr/libexec/atrun)
Mar  9 01:40:00 b1 cron[15325]: (root) CMD FINISH (/usr/libexec/atrun)
Mar  9 01:50:00 b1 cron[7278]: (root) CMD START (/usr/libexec/atrun)
Mar  9 01:50:00 b1 cron[11210]: (root) CMD FINISH (/usr/libexec/atrun)
Mar  9 03:00:00 b1 cron[20942]: (root) CMD START (/usr/bin/newsyslog)
Mar  9 03:00:00 b1 cron[7959]: (root) CMD START (/usr/libexec/atrun)
Mar  9 03:00:00 b1 cron[7397]: (root) CMD FINISH (/usr/libexec/atrun)
Mar  9 03:00:00 b1 cron[26859]: (root) CMD FINISH (/usr/bin/newsyslog)
Mar  9 03:10:00 b1 cron[4584]: (root) CMD START (/usr/libexec/atrun)
Mar  9 03:10:00 b1 cron[12536]: (root) CMD FINISH (/usr/libexec/atrun)

It seems like either cron(1) is broken or its man page is.
>How-To-Repeat:
Schedule a cron job to run in the hour deleted by the change
to summer time?
>Fix:
I briefly looked at the cron implementation but couldn't find
code that looked like it was trying to do what the man page
describes during a time change.  Perhaps it is the man page
that is wrong?



Home | Main Index | Thread Index | Old Index