1.等待10秒进行重启
TOMCAT_HOME=/usr/local/tomcat8081
SHUTDOWN=$TOMCAT_HOME/bin/shutdown.sh
STARTTOMCAT=$TOMCAT_HOME/bin/startup.sh
WAIT_SECONDS=10
echo "shutdown tomcat8081"
$SHUTDOWN
ps -ef | grep tomcat | grep $TOMCAT_HOME | grep -v 'grep' | awk '{print $2}' | xargs kill - 9
#delete log file
rm $TOMCAT_HOME/logs/* -rf
#delete temp dir
rm $TOMCAT_HOME/work/* -rf
for (( sec=${WAIT_SECONDS}; sec >= 0 ;sec --))
do
echo -n "wait $sec seconds tomcat will be started"
echo -ne "\r"
sleep 1
done
echo "start tomcat8081"
$STARTTOMCAT
#print log
tail -f $TOMCAT_HOME/logs/catalina.out