# auth by shikun.zhou - EMail:shikun.zhou@bdqn.cn
# Last modified: 2018-1-15
# Filename: check_url.sh
# Description: wget monitoring check_url_active
while true
do
Mail="shikun.zhou@bdqn.cn"
FailCount=0
Retval=0
GetUrlStatus(){
for ((i=1;i<=3;i++))
do
wget -T 3 --tries=1 --spider {1} >> /dev/null
[ $? -ne 0 ] && let FailCount+=1;
done
if [ $FailCount -gt 1 ];then
Retval=1
Date=`date +%F" "%H:%M`
/usr/local/bin/sendEmail -f www@bdqn.cn -t shikun.zhou@bdqn.cn -s pbmail.bdqn.cn -u "check_url" -m "Date: $Date\nProblem: $url is not running"
else
Retval=0
fi
return $Retval
}
for url in `cat url.txt | sed '/^#/d'`
do
#$GetUrlStatus $url && echo yes || echo no
GetUrlStatus $url
done
sleep 2m
done
阅读(1309) | 评论(0) | 转发(0) |