#! /bin/tcsh # # Mailfilter monitoring script # pb@e-scribe.com 2002-03-26 # # This script is designed to run continuously in its own Terminal window. # To have it quit after showing current spamcount and deleted messages, use: # # spamwatch --once # # To see a summary of all logged items, not just those from today, use: # # spamwatch --all # # Set log location set SPAMLOG="~/Library/Logs/mailfilter.log" # Set length that log lines should be trimmed to set LINELEN=78 # Show the mailfilter process if it's running top -l 0 | grep "mailfilter" echo "" # Give the running total echo "Spam messages killed to date:" cat $SPAMLOG | grep "Deleted" | wc -l echo "" # Show the stuff that was killed today if ($1 == "--all") then cat $SPAMLOG | grep "Deleted" | sed "s/mailfilter: Deleted//" | tr -s " " " " | colrm $LINELEN else echo "Killed today:" set dtext = "`date | colrm 11`" cat $SPAMLOG | grep "$dtext" -A 999 | grep "Deleted" | sed "s/mailfilter: Deleted//" | tr -s " " " " | colrm $LINELEN endif echo "" # Show running log if ($1 != "--once" && $1 != "--all") then echo "Running:" tail -n 0 -f $SPAMLOG | colrm $LINELEN endif