Weblog entry #2 for rossen
Here is a tip that will help to reduce the clutter of the sysadmin's mailbox: pipe the STDOUT (and optionally STDERR) of simple cronjobs into your system log using the logger(1) program which is part of the "bsdutils" package.
For example, suppose you have a job called "my-backup" that backs-up a directory and you want to keep the verbose-but-boring output "just in case". Instead of a specifying the cronjob in /etc/cron.d/backup as
@hourly root /usr/local/sbin/my-backup
redirect the standard output to the syslog with
@hourly root /usr/local/sbin/my-backup | logger -t my-backup
or, if the error messages are known to be non-urgent, redirect output AND errors to the syslog with
@hourly root /usr/local/sbin/my-backup 2>&1 | logger -t my-backup
The option "-t my-backup" will nicely tag each line with the string "my-backup", allowing one to easily grep the contents of /var/log.