日期:2014-05-16  浏览次数:20729 次

linux下tomcat7的自动启动配置

?[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/sh下输入

???????? # 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!