写一自动重启脚本,定时自动检查tomcat http页面是否能够访问 if wget http://wap.abc.com.cn/index.jsp
then
if wget http://mo.abc.cn/a.jsp
then
if wget http://wap.abc.com.cn:8080/index.jsp
then
if wget http://wap.abc.com.cn:9090/index.jsp
then
rm -f index.jsp*
rm -f a.jsp*
elif /opt/tomcat9090/bin/shutdown.sh
ps aux | grep tomcat9090 | grep -v "grep"
then
kill -9 $(ps aux | grep tomcat9090 | awk '{print $2}')
su - tiger -c "/opt/tomcat9090/bin/startup.sh"
rm -f index.jsp*
rm -f a.jsp*
else
su - tiger -c "/opt/tomcat9090/bin/startup.sh"
rm -f index.jsp*
rm -f a.jsp*
fi
elif /opt/tomcat8080/bin/shutdown.sh
ps aux | grep tomcat8080 | grep -v "grep"
then
kill -9 $(ps aux | grep tomcatr8080 | awk '{print $2}')
su - tiger -c "/opt/tomcat8080/bin/startup.sh"
rm -f index.jsp*
rm -f a.jsp*
else
su - tiger -c "/opt/tomcat8080/bin/startup.sh"
rm -f index.jsp*
rm -f a.jsp*
fi
elif
/opt/tomcat9090/bin/shutdown.sh
/opt/tomcat8080/bin/shutdown.sh
ps aux | grep tomcat9090 | grep -v "grep"
then
if
kill -9 $(ps aux | grep tomcat9090 | awk '{print $2}')
su - tiger -c "/opt/tomcat9090/bin/startup.sh"
ps aux | grep tomcat8080 | grep -v "grep"
then
kill -9 $(ps aux | grep tomcatr8080 | awk '{print $2}')
su - tiger -c "/opt/tomcat8080/bin/startup.sh"
rm -f index.jsp*
rm -f a.jsp*
else
su - tiger -c "/opt/tomcat8080/bin/startup.sh"
rm -f index.jsp*
rm -f a.jsp*
fi
elif
su - tiger -c "/opt/tomcat9090/bin/startup.sh"
ps aux | grep tomcat8080 | grep -v "grep"
then
kill -9 $(ps aux | grep tomcatr8080 | awk '{print $2}')
su - tiger -c "/opt/tomcat8080/bin/startup.sh"
rm -f index.jsp*
rm -f a.jsp*
else
su - tiger -c "/opt/tomcat8080/bin/startup.sh"
rm -f index.jsp*
rm -f a.jsp*
fi
elif
/opt/tomcat9090/bin/shutdown.sh
/opt/tomcat8080/bin/shutdown.sh
ps aux | grep tomcat9090 | grep -v "grep"
then
if
kill -9 $(ps aux | grep tomcat9090 | awk '{print $2}')
su - tiger -c "/opt/tomcat9090/bin/startup.sh"
ps aux | grep tomcat8080 | grep -v "grep"
then
kill -9 $(ps aux | grep tomcatr8080 | awk '{print $2}')
su - tiger -c "/opt/tomcat8080/bin/startup.sh"
rm -f index.jsp*
rm -f a.jsp*
else
su - tiger -c "/opt/tomcat8080/bin/startup.sh"
rm -f index.jsp*
rm -f a.jsp*
fi
elif
su - tiger -c "/opt/tomcat9090/bin/startup.sh"
ps aux | grep tomcat8080 | grep -v "grep"
then
kill -9 $(ps aux | grep tomcatr8080 | awk '{print $2}')
su - tiger -c "/opt/tomcat8080/bin/startup.sh"
rm -f index.jsp*
rm -f a.jsp*
else
su - tiger -c "/opt/tomcat8080/bin/startup.sh"
rm -f index.jsp*
rm -f a.jsp*
fi
then
if wget http://mo.abc.cn/a.jsp
then
if wget http://wap.abc.com.cn:8080/index.jsp
then
if wget http://wap.abc.com.cn:9090/index.jsp
then
rm -f index.jsp*
rm -f a.jsp*
elif /opt/tomcat9090/bin/shutdown.sh
ps aux | grep tomcat9090 | grep -v "grep"
then
kill -9 $(ps aux | grep tomcat9090 | awk '{print $2}')
su - tiger -c "/opt/tomcat9090/bin/startup.sh"
rm -f index.jsp*
rm -f a.jsp*
else
su - tiger -c "/opt/tomcat9090/bin/startup.sh"
rm -f index.jsp*
rm -f a.jsp*
fi
elif /opt/tomcat8080/bin/shutdown.sh
ps aux | grep tomcat8080 | grep -v "grep"
then
kill -9 $(ps aux | grep tomcatr8080 | awk '{print $2}')
su - tiger -c "/opt/tomcat8080/bin/startup.sh"
rm -f index.jsp*
rm -f a.jsp*
else
su - tiger -c "/opt/tomcat8080/bin/startup.sh"
rm -f index.jsp*
rm -f a.jsp*
fi
elif
/opt/tomcat9090/bin/shutdown.sh
/opt/tomcat8080/bin/shutdown.sh
ps aux | grep tomcat9090 | grep -v "grep"
then
if
kill -9 $(ps aux | grep tomcat9090 | awk '{print $2}')
su - tiger -c "/opt/tomcat9090/bin/startup.sh"
ps aux | grep tomcat8080 | grep -v "grep"
then
kill -9 $(ps aux | grep tomcatr8080 | awk '{print $2}')
su - tiger -c "/opt/tomcat8080/bin/startup.sh"
rm -f index.jsp*
rm -f a.jsp*
else
su - tiger -c "/opt/tomcat8080/bin/startup.sh"
rm -f index.jsp*
rm -f a.jsp*
fi
elif
su - tiger -c "/opt/tomcat9090/bin/startup.sh"
ps aux | grep tomcat8080 | grep -v "grep"
then
kill -9 $(ps aux | grep tomcatr8080 | awk '{print $2}')
su - tiger -c "/opt/tomcat8080/bin/startup.sh"
rm -f index.jsp*
rm -f a.jsp*
else
su - tiger -c "/opt/tomcat8080/bin/startup.sh"
rm -f index.jsp*
rm -f a.jsp*
fi
elif
/opt/tomcat9090/bin/shutdown.sh
/opt/tomcat8080/bin/shutdown.sh
ps aux | grep tomcat9090 | grep -v "grep"
then
if
kill -9 $(ps aux | grep tomcat9090 | awk '{print $2}')
su - tiger -c "/opt/tomcat9090/bin/startup.sh"
ps aux | grep tomcat8080 | grep -v "grep"
then
kill -9 $(ps aux | grep tomcatr8080 | awk '{print $2}')
su - tiger -c "/opt/tomcat8080/bin/startup.sh"
rm -f index.jsp*
rm -f a.jsp*
else
su - tiger -c "/opt/tomcat8080/bin/startup.sh"
rm -f index.jsp*
rm -f a.jsp*
fi
elif
su - tiger -c "/opt/tomcat9090/bin/startup.sh"
ps aux | grep tomcat8080 | grep -v "grep"
then
kill -9 $(ps aux | grep tomcatr8080 | awk '{print $2}')
su - tiger -c "/opt/tomcat8080/bin/startup.sh"
rm -f index.jsp*
rm -f a.jsp*
else
su - tiger -c "/opt/tomcat8080/bin/startup.sh"
rm -f index.jsp*
rm -f a.jsp*
fi
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货