Tomcat-7 配置為 Linux Service --- 轉(zhuǎn)
Configure Tomcat-7
[root@localhost ~]cd /tomcat7
[root@localhost tomcat7]cd /bin
[root@localhost bin]cp catalina.sh /etc/init.d
[root@localhost tomcat7]cd /etc/init.d
[root@localhost init.d]pwd
/etc/init.d
[root@localhost init.d]mv catalina.sh tomcat
[root@localhost init.d]vi tomcat
--------------------
在#!/bin/bash下輸入
# chkconfig: 2345 10 90
# description:Tomcat service
在#OS specific support................上輸入
CATALINA_HOME=/tomcat7
JAVA_HOME=/usr/java/jdk1.6.0_10
保存并退出文件
--------------------
[root@localhost init.d]chmod +x tomcat
[root@localhost init.d]cd /
[root@localhost /]vi /etc/profile
--------------------
在最后一行輸入
#CATALINA_HOME
CATALINA_HOME=/tomcat7
export CATALINA_HOME
保存并退出文件
--------------------
[root@localhost /]source /etc/profile
[3] Add tomcat to service list
[root@localhost /]chkconfig --add tomcat
[4] Check service list
[root@localhost /]chkconfig --list tomcat
tomcat 0:關(guān)閉 1:關(guān)閉 2:啟用 3:啟用 4:啟用 5:啟用 6:關(guān)閉
[5] Test tomcat service
[root@localhost /]service tomcat
--------------------
Using CATALINA_BASE: /tomcat7
Using CATALINA_HOME: /tomcat7
Using CATALINA_TMPDIR: /tomcat7/temp
Using JRE_HOME: /usr/java/jdk1.6.0_10
Using CLASSPATH: /tomcat7/bin/bootstrap.jar:/tomcat7/bin/tomcat-juli.jar
Usage: catalina.sh ( commands ... )
.
.
.
.
.
--------------------
[6] Start tomcat service
[root@localhost /]service tomcat start
[7] OK!