Make tomcat a service

Linux system

Unzip tomcat, enter the console
>cd /tomcat7
>cd /bin
>cp catalina.sh /etc/init.d
>cd /etc/init.d
>pwd
/etc/init.d
>mv catalina.sh tomcat
> vi tomcat
-------------------- Enter   # chkconfig: 2345 90 10
under #!/bin/bash   # description:Tomcat service is in #OS specific support... .............Enter CATALINA_HOME=/tomcat7 (absolute path of tomcat installation) JAVA_HOME=/usr/java/jdk1.8.0_121 (absolute path of jdk installation) save and exit the file -- ------------------ >chmod +x tomcat >cd / >vi /etc/profile ------------------ --Enter #CATALINA_HOME on the last line














CATALINA_HOME=/tomcat7 (same as above)
export CATALINA_HOME
to save and exit the file
--------------------
>source /etc/profile
==Add tomcat to service list==
>chkconfig --add tomcat
==Check service list==
>chkconfig --list tomcat
tomcat 0: off 1: off 2: on 3: on 4: on 5: on 6: off
==Test tomcat service==
>service tomcat
= =Start tomcat service==
>service tomcat start
==OK

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326460914&siteId=291194637