By Chuck Houpt

Cronic is a shell script to help control the most annoying feature of cron : unwanted emailed output, or "cram" (cron spam). If the Unix Haters list was still active, I would submit the rant below to gain membership. (feedback to: chuck@habilis.net )

One of the best features of cron is its automatic email - it is also its worst feature. Cron automatically emails the output of a cron job to the user. On the face of it, this sounds like a great idea. Cron jobs can run automatically in the background for months at a time - so getting an email when a problem occurs sounds useful.

Unfortunately, cron's idea of "output" is simultaneously too broad and too narrow to actually be useful. Cron considers any output to be significant - including standard output. This interacts badly with many unix commands, which often send status info to standard out. Some commands have a quiet options, but that can turn off all error output too. To make matters worse, cron ignores command result codes, meaning that errors from quiet programs are ignored.

It is almost impossible to create a non-trivial cron job that is quiet enough to run without output, but still reports all errors. Following the principle of "Worse is Better", the typical solution is to sweep it all under the carpet by redirecting all output to /dev/null, and hoping for the best:

0 1 * * * backup >/dev/null 2>&1

Now when your cron job fails, you will never know about it. Using cron to backup your files? Sorry, the cron job has been failing due to permission errors for months - all your files are gone.

Could cron be fixed? Although almost all current implementation of cron are open source, cron's pathological behavior has been petrified into the Unix standards. So if it isn't broken, it isn't cron. The only solution left is a work-around.