tomcat自动检查并重启脚本
仅供参考,技术有限只实现了基本功能。
仅供参考,技术有限只实现了基本功能。
- #!/bin/bash
- date
- export DATE=`date +%F%T`
- rm -rf /root/test.jsp
- wget -T 10 -t 3 -q http://10.10.15.49:8080/test.jsp
- if [ ! -e test.jsp ];then
- export CATALINA_HOME=/usr/local/tomcat6
- export PATH=/usr/local/tomcat6/bin:$PATH
- echo "restart tomcat"
- mv $CATALINA_HOME/logs/catalina.out $CATALINA_HOME/logs/catalina.out.$DATE
- > $CATALINA_HOME/logs/catalina.out
- skill -9 `ps -ef | grep "/usr/local/tomcat" | awk '{print $2}'`
- $CATALINA_HOME/bin/startup.sh
- fi
编辑回复