From Bugzilla Helper: User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; es-ES; rv:0.9.2) Gecko/20010726 Netscape6/6.1 Description of problem: The -r option in the command crontab is really harmfull. It does not ask for a confirmation and does not create a backup file. Version-Release number of selected component (if applicable): How reproducible: Always Steps to Reproduce: 1. crontab -r 2. 3. Actual Results: Your crontab is deleted with no warning Expected Results: A warning message should be fine, asking you to press 'Y' to delete the crontab. Additional info: The crontab configuration file is a really important file, and there is a really small probability that you may want to delete a crontab in a full production server in all your lifetime. Let me say: "crontab -r is evil"
Another problem is that the 'E' key is next to the 'R' key. The 'E' key is most used option in crontab, while the 'R' is most harmfull option that you can use in crontab.
try # crontab -l >crontab.save # vi crontab.save # crontab crontab.save The "L" key is nowhere near the "R" key. There are other ways that crontabs can be lost, so it is nice to make a habit of keeping a backup this way.
Hmmm. Not to be flippant over your loss, but there's lots of ways you can mess things up by typing a wrong option. "rm -f" is very close to rm -r on a QWERTY keyboard for example. I'm not going to change this because then we'd have to bulletproof the whole shell command line system. You can use "alias" to protect yourself much like dangerous commands such as "rm" and "mv" are aliased to interactive confirmation equivalents.
The very big diference between rm and crontab is that crontab does not provides an interactive option. In rm, alias rm="rm -i" should work, but in crontab you don't have this option. And since crontab -r is so harmfull, and does not provides an "-i" option, there should be a warning message and a confirmation should be asked. Another thing you can say is: "You should make backups of your crontabs", but I think that is a lot easier to make a "Are you sure you want to delete your crontab" message, than search for your tape backup and restore your crontab copy. Please don't get me wrong, I'm not lazy, I just want Linux to be more friendly. So, the options "-f" and "-i" (as in rm) should be be available in crontab.
*** This bug has been marked as a duplicate of 35985 ***