scripts in /etc/cron.daily , cron.weekly, cron.monthly not executed on 8.04 LTS Hardy
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
anacron (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
Binary package hint: anacron
In 8.04 anacron is started on bootup via init-scripts.
After executing the tasks which it finds need to be executed as the were not executed during shutdown it exits.
It is never invoked again.
In /etc/crontab you find lines like these:
56 4 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
0 1 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
50 1 25 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
The A || B is shell syntax for execute B only if A failed.
In case anacron is installed text-x /usr/sbin/anacron succeeds, so the scripts in cron.daily, weekly and monthly are _not_ executed here.
This issue is fixed in 10.04, but I think it's a serious security problem as many users follow guides about auto updating your server by placing a script in these directories (including me).
The fix to this is easy: Use the idea of the anacron package's /etc/cron.d/anacron file from Ubuntu 10.04:
--------
# /etc/cron.
SHELL=/bin/sh
PATH=/usr/
30 7 * * * root test -x /etc/init.d/anacron && /usr/sbin/
--------
If this file was included in 8.04's anacron package the anacron daemon would be restarted daily and do all the work in /etc/cron.daily weekly and monthly.