Created
September 5, 2019 02:30
-
-
Save abel533/d91b1151eb9e0a59d544a1858ef9cf7e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 | |
JAVA_HOME=/usr/java/jdk1.8.0_91/ | |
export JAVA_HOME | |
# 根据自己的路径改写CATALANA_HOME | |
CATALANA_HOME=/server/tomcat8/ | |
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
增加权限
chmod a+x /etc/init.d/tomcat
启动服务
service tomcat start
开机启动
/sbin/chkconfig tomcat on