#!/bin/bash
#jian kong
Server () {
timeout=10
faile=0
success=0
while true
do
/usr/bin/wget --timeout=$timeout --tries=1 http://www.baidu.com/ -q -o /dev/null
if [ $? -ne 0 ]
then
let faile=faile+1
success=0
else
faile=0
success=1
fi
if [ $success -ge 1 ]
then
exit 0
fi
if [ $faile -ge 2 ]
then
Critical="IMS is wrong,please fix it"
echo $Critical | mail -s "servers is wrong" zhangsan@hhh.com org
exit
fi
done
}
Server
echo "$$" >/var/run/web.pid
转载于:https://blog.51cto.com/13588698/2152977