Cron rant

The venerable Cron in its various forms (vixie-cron, anacron, etc) is good at what it does, but there are a lot of things that could make it much better to work with. For example:

  • "Debug" mode: run all the rules in a given crontab file right now and put errors on stdout. Even better if you can specify a pattern for which rules to run.

  • More options for errors besides just email. Like feed them to syslog, or pipe them to an external script, fall back to mailing them if that script doesn't exist or exits non-zero... External scripts open up a lot of possibilities like POSTing them to some web service or whatever.

Mail is also not really an option in some hosting environments like EC2. So you need alternatives.

  • Mail batching. When my job that runs every 5 minutes fails over the weekend, I don't really need 500 messages in my inbox. Something like, in 24 hours, send me the first failure from a given cron job, and at the end of the day send me a count of how many more failures there were and when the last one was. This might also be best done by simply doing notifications by calling some other program.

Best workaround for now is probably to grow your own script handling notifications and such, whicn cron calls, which in turn calls the "real" script. So intstead of:

30 * * * * /usr/bin/foo --foo=bar

... you'd do:

30 * * * * cron-wrapper /usr/bin/foo --foo=bar