#Tomcat 管理 守护进程脚本
/usr/local/tomcat/webapps/ROOT 发布目录 tomcat
如果启动多个tomcat服务,需要修改 800 8080 8009端口, 复制一次tomcat目录
Tomcat守护进程脚本
!/bin/bash
usage(){
echo "USAGE: start | stop | status"
}
define PID
tomcat_pid=`ps -ef |grep tomcat | grep -v "grep" |awk '{print $2}'`
TOMCAT_PATH=/usr/local/tomcat/
start(){
/usr/local/tomcat8/bin/startup.sh
}
status(){
ps -ef |grep tomcat | grep -v "grep"
}
stop(){
kill -9 $tomcat_pid
sleep 5
cd $TOMCAT_PATH
rm temp/* -rf
rm work/* -rf
TOMCAT_STATUS=$tomcat_pid
if [ -z $TOMCAT_STATUS ];then
echo "tomcat stop"
else
kill -9 $tomcat_pid
fi
}
MAIN(){
case $1 in
start)
start
;;
stop)
stop
;;
status)
status
;;
*)
usage
esac
}
MAIN $1