#!/bin/sh # # This script collects the total amount of recevied mails (incl. spam) # and the total of spam only marked mails per hour. # The script is performed for MRTG and must be scheduled at :59 min # # Caveats: Last minute before full hour is missing # # Mon Mar 8 15:59:32 CET 2010 hanr # # Where is your maillog MAILLOG=/var/log/mail.log # Spamassassin messages SPAMMSG="identified spam" CLEANMSG="clean message" # Timestamp in maillog DATE=`date '+%b %e %H:'` # Get spam mails SPAM=`grep "$SPAMMSG" $MAILLOG |grep -e "^$DATE" |wc -l` # Get clean mails CLEAN=`grep "$CLEANMSG" $MAILLOG |grep -e "^$DATE" |wc -l` TOTAL=`expr $SPAM + $CLEAN` echo $TOTAL echo $SPAM