将tomcat7添加到linux服务中(转)

****************************************

 

Tomcat-7 to Linux Service

 

****************************************

 

 

 

--------------------Documented Information

Creater:YCW

Create Date:2011-08-10

Contact email:[email protected]

 

 

 

--------------------Software Environment

· VMware Workstation 7.1.4 build-385536

· Red Hat Enterprise Linux (RHEL) 4

· Apche-Tomcat-7.0.6

 

 

 

--------------------Operation Steps

[1] Download Tomcat-7

URL:http://tomcat.apache.org/download-70.cgi

Tips:此处仅介绍关于Tomcat7配置Linux Service的部分,Tomcat的基础配置请参阅《Tomcat安装与配置》

 

[2] 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:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭

 

[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!

猜你喜欢

转载自linyu19872008.iteye.com/blog/1575253