首页 > 代码库 > tomcat监控
tomcat监控
参考:http://www.linuxidc.com/Linux/2012-11/74003.htm
#!/bin/shmonitorlog=/opt/tomcat7/logs/monitor.logmonitor(){ tomcatid=$(ps -ef |grep tomcat |grep -w ‘tomcat7‘|grep -v ‘grep‘|awk ‘{print $2}‘) tomcatup=/opt/tomcat7/bin/startup.sh tomcatcache=/opt/tomcat7/work tomcaturl=http://www.baidu.com/ok.jsp echo "[info]$(date +‘%F %H:%M:%S‘)" echo "[info]($tomcatid)" if [ $tomcatid ]; then http_code=$(curl -s -o /dev/null --connect-timeout 10 -m 20 $tomcaturl -w %{http_code}) if [ $http_code -eq 200 ]; then echo "[info]tomcat ok" else echo "[error]tomcat died ($http_code)" kill -9 $tomcatid sleep 3 rm -rf $tomcatcache $tomcatup fi else echo "[error]tomcat none" echo "[info]tomcat start" rm -rf $tomcatcache $tomcatup fi}monitor>>$monitorlog
tomcat监控
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。