监控web脚本二

[root@db01-51 scripts]# cat check_web.sh 
#!/bin/bash
if [ `curl -I www.baidu.com 2>/dev/null|head -1|egrep "200|302|301"|wc -l` -eq 1 ]
  then 
    echo "httpd is running"
  else
    echo "httpd is stopped"
fi

  

posted @ 2017-03-11 11:41  reborn枪  阅读(59)  评论(0)    收藏  举报