cron-bug

cron-daily scripts run strangely

It appears as if a script added to /etc/cron-daily doesn't always make the script automatically run. Anecdotal evidence indicates that in some cases cron needs to be reloaded. Initially the problem was detected on a gutsy-server where a backup script had not run for around six weeks.

This is the sample code we're using:

date >> /var/log/date.log

gutsy-server

owh report

This server was where the original problem occurred. The cron script didn't run for around six weeks, that is, cron.daily ran, but the backup script did not.

  1. On instruction from #ubuntu-server, installed postfix to at least receive output from cron
  2. ran sudo invoke.rc cron reload

Cron jobs ran just fine - including the backup.

  1. Added date script cron job without reloading cron
  2. Cron job ran just fine.

Jeeves_ report

From IRC: (Jeeves_ report extracted from within the log)

(15:43:31) owh: Is that a bug or a *feature*?
(15:43:43) Jeeves_: owh: That would be a bug
(15:44:08) Jeeves_: However, I've never seen it before, except for this week
(15:44:14) owh: I'm not even sure how it could even happen.
(15:44:28) owh: I mean run-parts runs every time cron runs.
(15:44:33) Jeeves_: Me neither
(15:45:03) owh: You know, come to think of it, I wonder if in the deeper past I've seen something similar.
(15:53:19) owh: Jeeves_: Do you remember the circumstances in which you had to reload cron?
(15:54:08) Jeeves_: owh: Yes, we copied files in /etc/cron.d/
(15:55:26) owh: Jeeves_: Which version of OS?
(15:56:10) Jeeves_: gutsy

hardy-server

alpha-6 clean install

  1. Added date script cron job without reloading cron
  2. Cron job did not run.
  3. grep daily /var/log/*

    -- no relevant results --

gutsy-workstation

This workstation has been installed from edgy and has been upgraded to feisty then gutsy.

  1. Installed cron daily job
  2. No output at expected time - 6:25am
  3. Output at 7:35am
  4. grep daily /var/log/* returned

    /var/log/syslog:Mar 15 07:38:20 localhost anacron[16254]: Job `cron.daily' terminated
    /var/log/syslog.0:Mar 15 06:25:01 localhost /USR/SBIN/CRON[15300]: (root) CMD (test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily ))
    /var/log/syslog.0:Mar 15 07:30:03 localhost anacron[16254]: Will run job `cron.daily' in 5 min.
    /var/log/syslog.0:Mar 15 07:35:03 localhost anacron[16254]: Job `cron.daily' started
    /var/log/syslog.0:Mar 15 07:35:03 localhost anacron[16306]: Updated timestamp for job `cron.daily' to 2008-03-15
  5. This indicates some interaction between anacron and cron

OnnoBenschop/ubuntu-server/cron-bug (last edited 2008-08-06 16:16:48 by localhost)