1. 程式人生 > >tomcat啟動指令碼

tomcat啟動指令碼

1.建立啟動指令碼
# vim /etc/init.d/tomcat
#!/bin/bash														
# Init file for Tomcat server daemon					
#																		
# chkconfig: 2345 96 14								    	
# description: Tomcat server daemon			    	
JAVA_OPTS='-Xms64m -Xmx128m'						
JAVA_HOME=/usr/java/jdk1.8.0_151/				    	
CATALINA_HOME=/usr/local/tomcat				    	
export JAVA_OPTS JAVA_HOME CATALINA_HOME  
exec $CATALINA_HOME/bin/catalina.sh $*			

2.修改許可權
# chmod a+x /etc/init.d/tomcat 

3.新增到chkconfig管理
# chkconfig --add tomcat
# chkconfig tomcat --list
tomcat          0:關閉  1:關閉  2:啟用  3:啟用  4:啟用  5:啟用  6:關閉
# chkconfig tomcat on
# 
# service tomcat stop
Using CATALINA_BASE:   /usr/local/tomcat
Using CATALINA_HOME:   /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME:        /usr/java/jdk1.8.0_151
Using CLASSPATH:       /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar

# service tomcat start
Using CATALINA_BASE:   /usr/local/tomcat
Using CATALINA_HOME:   /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME:        /usr/java/jdk1.8.0_151
Using CLASSPATH:      /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar