#/bin/bash hostname=$(uname -n) processcheck=$(ps aux|grep spamd|grep spamd.pid) miltercheck=$(ps aux|grep milter|grep spamass-milter) date=$(/bin/date) errormessage=("This is the automated spamd script on $hostname. It appears that spamd was not running at $date, and was automagically restarted. Please check the status of the process.") miltererrormessage=("This is the automated milter script on $hostname. It appears that milter was not running at $date, and was automagically restarted. Please check the status of the process.") #check spamassassin if [ -n "$processcheck" ]; then echo -e "all good" else /etc/init.d/spamassassin start echo $errormessage | /bin/mail -s "***WARNING*** spamd failure" -c admin1@domain.com.au fi #check spamass-milter if [ -n "$miltercheck" ]; then echo -e "all good" else /etc/init.d/spamass-milter restart echo $miltererrormessage | /bin/mail -s "***WARNING*** spamass-milter failure" admin2@domain.com.au fi