腳本存放目錄 /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 停止