#!/sbin/sh # syslogMailer (c) 1997 Peter Beckman # All Rights Released to the world # THIS IS PUBLISHED PROPRIETARY SOURCE CODE OF Purple Cow Industries # The copyright notice above does not evidence any # actual copyright on this code. It just looks cool. #ident "@(#)syslogmailer 1.4 97/05/20 PCB" /* SVr5.0 1.6 */ # this command is used to send mail to the administrators of a # remote machine for monitoring/security purposes. It was # written with the intent that it would run nightly as a cron # job. Here is the line I added to my crontab: # # 30 1 * * * /usr/local/sbin/syslogmailer #set umask umask 022 # log files LOG=/var/log/syslog HOSTNAME=`hostname` # find the size of the log file (in blocks) if [ -f $LOG ] then MONTH=`/usr/bin/date | cut -f2 -d" "` XDAY=`/usr/bin/date +%d` DAY=`echo "$XDAY-1" | bc` DATE="$MONTH $DAY" grep "$DATE" $LOG | Mail -s "syslog for $DATE" admin fi