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.
- On instruction from #ubuntu-server, installed postfix to at least receive output from cron
- ran sudo invoke.rc cron reload
Cron jobs ran just fine - including the backup.
- Added date script cron job without reloading cron
- 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
- Added date script cron job without reloading cron
- Cron job did not run.
grep daily /var/log/*
-- no relevant results --
gutsy-workstation
This workstation has been installed from edgy and has been upgraded to feisty then gutsy.
- Installed cron daily job
- No output at expected time - 6:25am
- Output at 7:35am
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
- This indicates some interaction between anacron and cron