本文共 362 字,大约阅读时间需要 1 分钟。
1 2 3 4 5 6 7 8 9 | #/bin/bash # monitoring web is running curl www.163.com -I| awk -F ' ' '{print $2}' | sed 's/[a-zA-Z]//g' | grep 200 if [ $? == 0 ] then echo "web is running ok" else echo "web is dead" |mail -s "web is not running" 1306xxx@139.com fi |
注:只要返回不是200,就会发邮件告警
缺点:如果返回的是301,就会误判\本文转自 boy461205160 51CTO博客,原文链接:http://blog.51cto.com/461205160/1744345
转载地址:http://mhqpo.baihongyu.com/