My ongoing experiences with Ubuntu, and later Mythbuntu, as a media center with MythTV. I'm also using the system for a virtual machine server, a mediawiki server and a general all around home infrastructure base.

Wednesday, March 18, 2009

Using cronic to reduce "cram" (cron spam)

I'm working on reducing the about of email I'm getting from my cron jobs. One thing I stumbled across is cronic. I used it as following to quiet my cron jobs.

First, to install it:
# wget -O /usr/local/bin/cronic http://habilis.net/cronic/cronic
...
# chmod 755 /usr/local/bin/cronic
Now to use it, edit your cron scripts to use cronic as a wrapper. Before:
# cat /etc/cron.daily/backup-web-server
#!/bin/sh
/usr/local/bin/backup-web-server.py /etc/backup-web-server.conf
And after:
# vi /etc/cron.daily/backup-webserver
# cat /etc/cron.daily/backup-web-server
#!/bin/sh
/usr/local/bin/cronic /usr/local/bin/backup-web-server.py /etc/backup-web-server.conf
That's it. Now unless your cron job either has output to stderr or returns non-zero, it will produce no output.

No comments: