码迷,mamicode.com
首页 > 数据库 > 详细

web站点监控脚本web_status_code,tomcat 80,oracle1521

时间:2015-04-13 14:12:33      阅读:157      评论:0      收藏:0      [点我收藏+]

标签:

1,完整的监控脚本如下

技术分享
#!/bin/bash

#web_status_code=`curl -o /dev/null -s -w "http_code:%{http_code}" http://yjszs.nudt.edu.cn/`
#1,
web_status_code=`curl -o /dev/null -s -w "http_code:%{http_code}" http://yjszs.nudt.edu.cn/home/home_init.shtml`
#echo ${web_status_code}
if [ ${web_status_code} != 200 ];then
        echo ${web_status_code} | /bin/mail -s "web site service-status Infos" rui.qin@egrandis.com
        /usr/local/webserver/tomcat6/bin/startup.sh
fi

#tomcat-port-80
counts=`lsof -i:80 | wc -l`
if [ ${counts} == 0 ];then
        echo ${counts} | /bin/mail -s "web site tomcat 80 port Exception Infos" rui.qin@egrandis.com
        /usr/local/webserver/tomcat6/bin/startup.sh
fi

#Oracle11g port -1521
port=`lsof -i:80 | wc -l`
if [${port} == 0];then
        echo "Oracle 1521 port no Listen" | /bin/mail -s "web site Oracle11g 1521 port Infos" rui.qin@egrandis.com
        su - oracle -c "/DBSoftware/app/oracle/product/10.2.0/db_1/bin/lsnrctl start" 2>/dev/null;
        su - oracle -c "sqlplus \"/as sysdba\" <<EOF  
startup;  
exit  
EOF"
fi
View Code

 

web站点监控脚本web_status_code,tomcat 80,oracle1521

标签:

原文地址:http://www.cnblogs.com/ruiy/p/4421870.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!