Comment 3 for bug 36690

Revision history for this message
Miek Gieben (miek) wrote :

I have a cron job that starts every 2 minutes after the hour
2 * ... ...

when DST is in effect, cron does:

cron.c: line 220:

/* run wildcard jobs for current minute */
find_jobs(timeRunning, &database, TRUE, FALSE);

this should match my cron, but it gets started at the wrong minute, so
it missing my cron job.

Next: cron.c: line 222:
/* run fixed-time jobs for each minute missed */
do {
        if (job_runqueue())
                sleep(10);
        virtualTime++;
        find_jobs(virtualTime, &database, FALSE, TRUE);
        set_time();
        ...

Now all cron jobs get run without any wildcards (FALSE, TRUE), so my
2 minute after the hour cron is missed:
(i've added some debugging):
## = my comments

[19419] tick(2,10,11,3,3) No wildcard
user [root:0:0:...] cmd="test -x /usr/sbin/anacron || run-parts --report /etc/cron.monthly"
user [root:0:0:...] cmd="test -x /usr/sbin/anacron || run-parts --report /etc/cron.weekly"
user [root:0:0:...] cmd="test -x /usr/sbin/anacron || run-parts --report /etc/cron.daily"
user [root:0:0:...] cmd=" run-parts --report /etc/cron.hourly"
user [root:0:0:...] cmd="test -x /etc/init.d/anacron &&
/usr/sbin/invoke-rc.d anacron start >/dev/null"
user [root:0:0:...] cmd="/home/miekg/cron2sh"
not adding
flags 13
## this cron2sh should have been added because we on minute 2: tick(2, ...)
## but it isn't, flags is 0x13 indicating that wildcards are in effect
user [root:0:0:...] cmd="/home/miekg/cronsh"
not adding
flags 1b

cron.c: line 347
if ((doNonWild && !(e->flags & (MIN_STAR|HR_STAR)))
                || (doWild && (e->flags &
                                (MIN_STAR|HR_STAR)))) {
        job_add(e, u);

because doWild is FALSE the 'or' statement in the 'if' isn't executed
and the job isn't added.

I don't know what effect making doWild true has on the rest of CRON,
but it could be a fix.