监控服务脚本

[root@mail shell]# clear
[root@mail shell]# cat chkamavisd.sh
#!/bin/bash
while true
do
DATA=`date +%Y-%m-%d-%H:%M`
COUNT=`cat /shell/amavisd.log | wc -l`
ps aux   |  grep amavisd | grep -v grep |  grep -v  chkamavisd.sh  &> /dev/null
if [ $? -ne 0 ];
then
echo "$DATA err" >> /shell/amavisd.log
echo  "fu wu err ci shu: $COUNT"  > /shell/toji
    /etc/init.d/amavisd restart
fi
sleep 10
done


你可能感兴趣的:(监控,服务脚本)