tomcat启停脚本
程序员文章站
2022-05-18 12:23:50
脚本存放目录 /etc/init.d/ /etc/init.d/tomcat restart 重启/etc/init.d/tomcat start 启动/etc/init.d/tomcat stop 停止 ......
脚本存放目录 /etc/init.d/
#!/bin/bash
# description: tomcat7 start stop restart
# processname: tomcat7
# chkconfig: 234 20 80
catalina_home=/sdata/software/apache-tomcat-8.5.23
case $1 in
start)
sh $catalina_home/bin/startup.sh
;;
stop)
ps -e|grep java|awk '{print "kill -9 "$1}'|sh
# sh $catalina_home/bin/shutdown.sh
;;
restart)
ps -e|grep java|awk '{print "kill -9 "$1}'|sh
sleep 3
# sh $catalina_home/bin/shutdown.sh
sh $catalina_home/bin/startup.sh
;;
*)
echo 'please use : tomcat {start | stop | restart}'
;;
esac
exit 0
/etc/init.d/tomcat restart 重启
/etc/init.d/tomcat start 启动
/etc/init.d/tomcat stop 停止
上一篇: Linux学习笔记之一