System administrators have always faced a challenge when it comes to dealing with scheduled tasks. Specifically, each task that runs likely generates output which is e-mailed to the administrator. Most of the messages will be simple confirmations that everything went according to plan, but sometimes the output will indicate something went wrong. It is not a good idea to discard all of the messages and it can be cumbersome to set up filters to deal with the torrent of e-mails. Job Snijders has published a patch for OpenBSD's implementation of cron which allows the administrator to discard all output in cases where jobs complete successfully, but also be e-mailed a command's complete output if the job fails. "To improve the situation I propose to add a simple crontab(5) convenience option called '-n' (mnemonic 'No mail if run successful'). Note that options already are a thing in vixie cron ('-q' has existed for decades?), but are not part of POSIX. With this 'no mail if success' option you can do things like:
* * * * * -n cp -rv src/ dest/
With the above example crontab(5) entry you'll only receive a mail from cron(8) if the cp(1) encountered some kind of error. You'll also have in that e-mail up until what point cp(1) actually was able to copy files." The NetBSD team has already adopted the new cron feature.
Star Labs - Laptops built for Linux.
View our range including the Star Lite, Star LabTop and more. Available with a choice of Ubuntu or Linux Mint pre-installed with many more distributions supported. Visit Star Labs for information, to buy and get support.