#!/bin/sh # Script to check main-services # ti/21.03.2001 date=`/bin/date +"%d.%m.%Y %k:%M:%S"` echo -e "$date, " # Check named numofproces=`ps ax | grep -v "grep" | grep -c /usr/sbin/named` if test "$numofproces" -eq "0" then ps ax>/tmp/proclist mail root -s "***** named died ***** ">/var/log/chkproc.log 2>>/var/log/chkproc_err.log ps ax>/tmp/proclistB mail root -s "***** named restarted *****"/tmp/proclist mail root -s "***** sendmail died ***** ">/var/log/chkproc.log 2>>/var/log/chkproc_err.log ps ax>/tmp/proclistB mail root -s "***** sendmail restarted *****"/tmp/proclist mail root -s "***** popwatch died *****">/var/log/chkproc.log 2>>/var/log/chkproc_err.log ps ax>/tmp/proclistB /bin/date|mail root -s "***** popwatch restarted *****" rm /tmp/proclistB fi echo -e "\tNumber of popwatch-processes running now:\t $numofproces" | tee -a $err # Check mysql ledir=/usr/sbin numofproces=`ps ax | grep -v "grep" | grep -c /usr/libexec/mysqld` if test "$numofproces" -eq "0" then ps ax>/tmp/proclist mail root -s "***** mysql died *****">/var/log/chkproc.log 2>>/var/log/chkproc_err.log ps ax>/tmp/proclistB mail root -s "***** mysql restarted *****"/tmp/proclist mail root -s "***** apache died *****">/var/log/chkproc.log 2>>/var/log/chkproc_err.log ps ax>/tmp/proclistB mail root -s "***** apache restarted *****"