监控Tomcat并启动
#!/bin/sh export _JAVA_SR_SIGNUM=12 export JAVA_HOME=/usr/java/jdk1.6.0_11 export CATALINA_BASE=/home/co_newest_family/tomcat export CATALINA_HOME=/usr/local/apache-tomcat-6.0.18 export LD_LIBRARY_PATH=:/usr/local/lib/:/usr/local/apr/lib/:/usr/local/apr/lib/ export CATALINA_OPTS="-server -Xms1024m -Xmx2048m -XX:PermSize=128m -XX:MaxPermSize=128m -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9158 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dfile.encoding=UTF8 -Dmeganotes.home=/home/co_newest_family" export PATH=$JAVA_HOME/bin:$PATH:$HOME/bin date=`date "+%H:%M:%S"` message="$date|check_tomcat(81_co_newest_family)_shutdown_and_restart_it." request_url="http://10.27.5.81:9091/index.jsp" if ! wget -t1 -T2 $request_url &> /dev/null;then #pid=`ps aux | grep "\-Dcms4.home\=\/home\/co_newest_family\/"| awk '{print $2}'` #kill -9 $pid ps x|grep 'tomcat'|grep -v 'grep'|grep -v 'sh'|awk '{print $1}'|xargs kill -9 $CATALINA_HOME/bin/startup.sh wget -t1 -T2 http://10.27.5.112:8880/send.jsp?msg=$message &> /dev/null; echo "$date check tomcat shutdown and restart it." >> logs/check.log else echo "$date check tomcat ok." >> logs/check.log fi rm -f index.jsp* rm -f send.jsp?msg=*
**********************************************
对于一件事情,往往超过我们的想象,自信、坚持,勇往直前!
参与者:Rainbow Gu
地址:南都
***********************************************