Someone edits a cron file in the most common editor, vim. On many systems it doesn't do an atomic swap on save without extra configuration: http://stackoverflow.com/questions/13563627/how-does-vim-sav...
Now maybe your unresponsive, undergoing swap, system misses a cron job that was present in both edits. Opps.
I'm not sure this could really play out, but the approach definitely sounds firmly on the "worse is better" side of the scale.
Otherwise adding a file or deleting a file in /etc/cron.d/ is the way to go for automatic(ansbile, puppet etc) and package installations.
However crontab -r has to be one of the most poorly thought out commands in UNIX. It removes the cron file and since r is only one character over from e on qwerty keyboards it's a painful and surprising typo.
Instead of per-user crontabs. Much easier to manage.
With cron.d you can specify what user each cron entry should run as, so it is equivalent.
2. Puppet handled that parsing for you and will throw errors if your syntax is wrong
Honestly though, I never use `-e` either. I keep a ~/.crontab and edit that, and then `crontab ~/.crontab`.
Voila, backup/time machine/git friendly crontab.
And there's "vipw" for the password file. Each of them with their own separate updating bugs.
Nobody argues that there can't be problems. What all critics miss is to show how to avoid these problems.
What can you do about jobs that make the system unresponsive? Not a problem for cron to solve.
If someone writes a crontab (instead of rename()ing another version over it), that's not cron's fault. Sqlite databases can be just as easily corrupted or lose integrity. Now which format would you rather repair?
Missing a cron job can not be totally avoided, and it isn't the end of the world. What if your machine goes down or cron crashes? The answer is that the jobs themselves have to be provided with some resilience against that situation.
This isn't a case of "worse is better" since there weren't proposed solutions to the "problems" at all, however unrealistic.
Most of the things living under /etc are not databases. crontab certainly isn't:
- Only a single "table" (no table-relations)
- No standard database type exists for columns (how would you model the scheduling as database types, how would you model the shell command as database types, if not simply as sanitized strings)
So you can't get integrity for free. Need a custom parser and some integrity checks. Not so difficult (yes, cron will give instant feedback for the unlikely case that you did something wrong)
Re: editor, locking, access control:
I have an editor and prefer it to writing SQL DML any day.
File updates (rename(2)) are atomic, so no need for additional locking. And even if there is some broken tool writing to the old file instead of rename, the chances of that being simultaneous with a parse are microscopic. Don't overdesign. (there are many more things that can go wrong in a system that you can't possibly design out. Live with it).
Access control: Standard file permission modes are just fine. More complex permission model would be a serious overdesign. You can get granularity by using separate crontabs.
Checker: Never needed an additional tool to format the meaning as human-readable text. The syntax is a bit ugly but quite easy to remember and use.