linux 监控服务脚本 发表于 2018-05-30 | 更新于 2019-09-03 | 分类于 shell | 阅读次数: 123456789101112131415161718192021 #!/bin/shweblist=/shell/web_monit/weblist.txt for list in `cat $weblist|grep -E -v "#|^$"` dohttpcode=`curl -o /dev/null -s -w %{http_code} "$list"` httptime=`curl -o /dev/null -s -w "time_connect: %{time_connect}\ntime_starttransfer: %{time_starttransfer}\ntime_total: %{time_total}\n" "$list"|grep time_total|awk -F ":" '{print $2*1000}'`if [ $httpcode = 500 ]||[ $httpcode = 502 ]||[ $httpcode = 503 ]||[ $httpcode = 504 ]then curl -d "mobile=13800008888&text=访问 $list 超时" "http://127.0.0.1/sms/"else echo "$list is checked ok!"fi if [ $httptime -ge 3000 ]then curl -d "mobile=13800008888&text=访问 $list 超时" "http://127.0.0.1/sms/"else echo "$list is connect ok!"fidone {———-} 同目录下 建立 weblist.txt 12http:www.wuxinvip.comhttps://www.wuxinvip.com 相关文章 linux 排查命令 node--npm 命令 git linux 删除命令 rm 改为 mv linux 清空缓存 赏了 微信支付 支付宝