Cron removes crontab after editting
After editting /etc/crontab/root with crontab -e, the crontab for root is deleted. This appears to take place when any of the default periodic jobs are executed. It does not appear to happen if the crontab never editted.
Test: I added a line to the root crontab to execute a script every 10
minutes. The script simply writes a line to stdout.
The line I added to crontab looks like this: /10 * * * /root/crontest
I used the crontab -e command to edit the crontab. After writing away the change, a file called ‘cron.update’ appears in /etc/crontabs/, containing a single line: root
Cron executes my job without issues until the first of the default periodic jobs is executed. At this point it removes both the ‘update.cron’ file and the root crontab completely. A backup of the crontab is kept in /var/spool/cron/cron.root.*
The above example is not completely reliable for the reason that the removal of the crontab does not necessarily occur on the execution of the first subsequent periodic job, but definitely at some point thereafter.
As I mentioned, if the crontab is never editted, this doesnt happen.
(from redmine: issue id 436, created on 2010-09-27, closed on 2011-03-24)
- Revision 8ee00785 by Timo Teräs on 2011-01-06T06:27:18Z:
main/busybox: fix disappearing crontabs bug It's uninitialized memory use bug. The relevant parts are rewritten in busybox-1.18.x and later, so this patch applies only to the busybox-1.17.x versions. Fixes #436.
- Revision 1677b385 by Timo Teräs on 2011-01-06T06:54:59Z:
main/busybox: fix disappearing crontabs bug It's uninitialized memory use bug. The relevant parts are rewritten in busybox-1.18.x and later, so this patch applies only to the busybox-1.17.x versions. Fixes #436. (cherry picked from commit 8ee0078586a14008b9915450dbc719051ed7d3d0)