網站連通性簡易測試腳本

#!/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" [email protected] org
exit
fi
done
}
Server
echo "$$" >/var/run/web.pid

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章