shell 監控url 地址

shell 監控url 地址

[root@localhost opt]# cat web_url.sh 
#!/bin/bash
for i in `cat web_url`
do
curl=`curl -I -s $i |head -1|cut -d " " -f2`
if [ "$curl" == "200" ];then
    echo curl $i is ok
else
    echo "$i is fail" | mail -s "web fail url"  [email protected]
fi
done

[root@localhost opt]# cat web_url
http://192.168.0.123:8080/lemon/portal/index.do
http://192.168.0.123:8080/photo/
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章