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

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" [email protected]
        /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" [email protected]
        /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" [email protected]
        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

 

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。