News for hackers. Stuff that matters.
Re:Cron checker by krrrh on Saturday July 16, 2016 @10:11AM (#12106379)
I'm surprised that people would edit cron in any other way, crontab -e is one of the first commands most intro to Linux manuals teaches.

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.

Re:Cron checker by mooneater on Saturday July 16, 2016 @11:16PM (#12108881)
first thing when logging into new server: place /etc under git. then loss of cron files (or any config file) is easily recovered from.
Re:Cron checker by pferde on Sunday July 17, 2016 @03:47AM (#12109397)
Except that crontabs are usually somewhere in /var. :)
Re:Cron checker by mooneater on Sunday July 17, 2016 @10:53PM (#12113010)
Which is why I only use system-wide crontabs, in /etc/cron.d

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.

Re:Cron checker by Drdrdrq on Sunday July 17, 2016 @01:37AM (#12109141)
This is a brilliant idea - thank you!
Re:Cron checker by mooneater on Sunday July 17, 2016 @10:55PM (#12113015)
I cannot count the number of times this has helped or saved me. You can keep the /etc git repo local. Or if its a critical server, push to github private repo. Seeing a history of your /etc edits is a very reassuring feeling.
Re:Cron checker by efiala on Saturday July 16, 2016 @10:37AM (#12106456)
what if you are managing the crons externally, eg puppet, crontab -e is not always option
Re:Cron checker by Godel_unicode on Saturday July 16, 2016 @12:01PM (#12106752)
1. If you don't have a test process for changes made with puppet, this is hardly a problem with cron.

2. Puppet handled that parsing for you and will throw errors if your syntax is wrong

Re:Cron checker by _ao789 on Saturday July 16, 2016 @01:09PM (#12107030)
I can't tell you the amount of times I've hit -r by mistake and regretted it..
Re:Cron checker by michaelcampbell on Saturday July 16, 2016 @03:46PM (#12107617)
I can. 0. There, more anecdata.

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.

Re:Cron checker by benjojo12 on Sunday July 17, 2016 @05:29PM (#12111940)
I got bit by this once, and had to rescue the crontab out off the disk with GNU strings :(
Re:Cron checker by dajohnson89 on Saturday July 16, 2016 @05:14PM (#12107899)
Have a cronjob that backs up your crontab?
Re:Cron checker by hibbelig on Saturday July 16, 2016 @12:54PM (#12106968)
Use /bin/cat as editor. That should work nicely from Puppet.