restart.sh
#! /bin/bash
tomcat_home=/usr/local/tomcat/apache-tomcat-9.0.7/
SHUTDOWN=$tomcat_home/bin/shutdown.sh
STARTTOMCAT=$tomcat_home/bin/startup.sh
echo "stop $tomcat_home"
$SHUTDOWN
ps -ef |grep tomcat |grep $tomcat_home |grep -v 'grep'|awk '{print $2}' | xargs kill -9
rm $tomcat_home/logs/* -rf
rm $tomcat_home/work/* -rf
sleep 5
echo "run $tomcat_home"
$STARTTOMCAT
网友评论