标签:
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
web站点监控脚本web_status_code,tomcat 80,oracle1521
标签:
原文地址:http://www.cnblogs.com/ruiy/p/4421870.html