Linux tomcat boot from boot

Source: Internet
Author: User

Linux tomcat boot from boot

Method One:

Modify the tomcat/bin/startup.sh to:

Export java_home=/home/java1.6.0_27

Export classpath= $CLASSPATH: $JAVA _home/lib/tools.jar: $JAVA _home/lib/dt.jar:.

Export path= $JAVA _home/bin: $PATH

Export Catalina_home=/home/tomcat

/home/tomcat/bin/catalina.sh start

Add in/etc/rc.d/rc.local:

/home/tomcat/bin/startup.sh

Method Two:

1. Save the following code as a tomcat file and make it an executable file chmod 755 tomcat.

#!/bin/bash

#

#/etc/rc.d/init.d/tomcat

# init script for Tomcat precesses

#

# Processname:tomcat

# description:tomcat is a Java EE server

# chkconfig:2345 86 16

# Description:start up the Tomcat servlet engine.

if [-f/etc/init.d/functions]; Then

. /etc/init.d/functions

elif [-f/etc/rc.d/init.d/functions]; Then

. /etc/rc.d/init.d/functions

Else

Echo-e "\atomcat:unable to locate functions lib. Cannot continue. "

Exit-1

Fi

Retval=$?

Catalina_home= "/home/tomcat"

Case "$" in

Start

If [-f $CATALINA _home/bin/startup.sh];

Then

echo $ "Starting Tomcat"

$CATALINA _home/bin/startup.sh

Fi

;;

Stop

If [-f $CATALINA _home/bin/shutdown.sh];

Then

echo $ "Stopping Tomcat"

$CATALINA _home/bin/shutdown.sh

Fi

;;

*)

echo $ "Usage: $ {start|stop}"

Exit 1

;;

Esac

Exit $RETVAL

2. Copy the Tomcat file to/etc/init.d/and run: Chkconfig--add Tomcat

3. Add the following statement in front of the tomcat/bin/catalina.sh file:

Export java_home=/home/jdk1.6.0_27

Export Catalina_home=/home/tomcat

Export Catalina_base=/home/tomcat

Export Catalina_tmpdir=/home/tomcat/temp

Test tomcat can start boot Tomcat:service tomcat start

Test tomcat can stop stop Tomcat:service tomcat stop

startup mode in which the service is started #chkconfig tomcat on

#chkconfig--list Tomcat

At this point, the self-startup script is completed

Attention:

In the comment statement for the first two lines of the Tomcat file, you need to include both Chkconfig and description (make sure not to misspell), or the "Chkconfig--add Tomcat" will appear when you perform the " The Tomcat service does not support Chkconfig "error message.

Chkconfig This line represents the run level of the default startup and the priority of start and stop, as if the service is no longer started at any run level by default--instead of the runlevel. such as the #chkconfig:345 61 61//345 parameter of this line indicates, at which runlevel to start, 345 means that the Tomcat script starts at run Level 2, 3, 4, 5, Start sequence number (S61), close ordinal (K61)

Description The service description, you can use "\" to cross-line comments.

    • This article is from: Linux Tutorial Network

Linux tomcat boot from boot

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.