时间:2020-10-09 22:41:54 | 栏目:Tomcat | 点击:次
1、vim /etc/init.d/tomcat
#!/bin/bash # # tomcat startup script for the Tomcat server # # chkconfig: 345 80 20 # description: start the tomcat deamon # # Source function library . /etc/rc.d/init.d/functions prog=tomcat JAVA_HOME=/usr/local/jdk1.8.0_161 export JAVA_HOME CATALANA_HOME=/opt/apache-tomcat-8.5.24/ export CATALINA_HOME case "$1" in start) echo "Starting Tomcat..." $CATALANA_HOME/bin/startup.sh ;; stop) echo "Stopping Tomcat..." $CATALANA_HOME/bin/shutdown.sh ;; restart) echo "Stopping Tomcat..." $CATALANA_HOME/bin/shutdown.sh sleep 2 echo echo "Starting Tomcat..." $CATALANA_HOME/bin/startup.sh ;; *) echo "Usage: $prog {start|stop|restart}" ;; esac exit 0
2、配置
chmod +x /etc/init.d/tomcat chkconfig tomcat on service tomcat start
总结