linux服务自动手动启动tomcat的方式

Linux服务自启动的方式有多种,有时候无法通过chkconfig命令运行级别设置和ntsysv图形运行级别设置时,此下方法可以有效解决问题。

生产环境:

OS: CentOS release 6.7 (Final)

Web服务器:Apache Tomcat/7.0.57

任务:Linux启动时需要自动启动Tomcat服务。

Linux自动启动服务配置方式如下:

[root@sky9896 ~]#

[root@sky9896~]# cd  /etc/rc.d

[[email protected]]# vi  rc.local

#!/bin/sh

#

# This script will beexecuted *after* all the other init scripts.

# You can put your owninitialization stuff in here if you don't

# want to do the full Sys Vstyle init stuff.

touch /var/lock/subsys/local

/usr/local/tomcat/bin/startup.sh  #随系统自动启动tomcat服务

/usr/local/apache2/bin/apachectlstart

手动启动Tomcat服务方式如下:

[root@sky9896 ~]#

[root@sky9896 ~]# cd  /usr/local/tomcat

[root@sky9896 tomcat]#cd  bin

[root@sky9896 bin]#

[root@sky9896 bin]#./shutdown.sh   #关闭tomcat服务

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.7.0_71

Using CLASSPATH:   /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar

[root@sky9896 bin]#./startup.sh    #启动tomcat服务

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.7.0_71

Using CLASSPATH:     /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar

Tomcat started.


你可能感兴趣的:(linux,服务器,local)