#!/bin/sh TOMCAT_PATH=`dirname "$0"` echo "TOMCAT_PATH is /usr/local/tomcat" PID=`ps aux | grep /usr/local/tomcat | grep java | awk '{print $2}'` if [ -n "$PID" ]; then echo "Will kill tomcat: $PID" sh "/usr/local/tomcat/bin/shutdown.sh" sleep 6 else echo "No Tomcat Process $PID" fi PID=`ps aux | grep /usr/local/tomcat | grep java | awk '{print $2}'` while [ -n "$PID" ]; do kill $PID && sleep 1 echo "Try to kill $PID" done sh "/usr/local/tomcat/bin/startup.sh" sleep 3 PID=`ps aux | grep /usr/local/tomcat | grep java | awk '{print $2}'` if [ -n "$PID" ]; then echo "\nRestart tomcat successfully!" else echo "\nFail to startup tomcat" exit 1 fi
/usr/local/tomcat你要替换的内容