Set the auto-start method of Tomcat in Linux

Source: Internet
Author: User

 

After Tomcat 5.5 is installed, it is very easy to decompress the downloaded package and put it in the corresponding directory. Then, after setting environment variables such as JAVA_HOME and CATALINA_HOME in the Linux environment, run the command in the bin directory of Tomcat. /catalina. sh run can start the tomcat service in the terminal mode. To add tomcat to the self-starting queue, perform the following operations:

Log on to the system as a root user:

Cd/etc/rc. d/init. d/

Vi tomcat

The file content is as follows:

       
        #!/bin/sh## tomcat: Start/Stop/Restart tomcat## chkconfig: 2345 80 20# description: Tomcat is a Java Servlet Container### match these values to your environment:export CATALINA_BASE=/usr/local/tomcatexport CATALINA_HOME=/usr/local/tomcatexport CATALINA_TMPDIR=/usr/local/tomcat/tempexport JRE_HOME=/usr/java/jdk15# Source function library.. /etc/rc.d/init.d/functionsTOMCAT=/usr/local/tomcatstart() {echo -n $"Starting Tomcat: "$TOMCAT/bin/catalina.sh start}stop() {echo -n $"Stopping Tomcat: "$TOMCAT/bin/catalina.sh stop}# See how we were called.case "$1" instart)start;;stop)stop;;status);;status);;restart)stopstart;;*)echo $"Usage: $0 {start|stop|restart}";;esacexit $RETVAL
       

Modify tomcat to a running file. The command is as follows:

Chmod a + x tomcat

Use the chkconfig command to add the tomcat command to the system startup queue:

Chkconfig -- add tomcat

View the status of apachectl:

Chkconfig -- list tomcat

Well, it's all done. It's a simple record. Hope to help you and let me remember it!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.