Under Linux Centos6.10, configure tomcat to start with the system

Modify the configuration file configuration java_home

vi /usr/local/tomcat/apache-tomcat-6.0.48/bin/setclasspath.sh

Increase in the position of the red frame

export JAVA_HOME=/usr/java/jdk1.7.0_79

Execute ( create file)

vi /etc/rc.d/init.d/tomcat

 

Copy the content to the file

 

#!/bin/bash

#

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

# init script for tomcat precesses

#

# processname: tomcat

# description: tomcat is a j2se 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

be

 

RETVAL=$?

CATALINA_HOME="/usr/local/tomcat/apache-tomcat-6.0.48/"

 

case "$1" in

start)

if [ -f $CATALINA_HOME/bin/startup.sh ];

then

echo $"Starting Tomcat"

$CATALINA_HOME/bin/startup.sh

be

;;

stop)

if [ -f $CATALINA_HOME/bin/shutdown.sh ];

then

echo $"Stopping Tomcat"

$CATALINA_HOME/bin/shutdown.sh

be

;;

*)

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

exit 1

;;

esac

 

exit $RETVAL

 

carried out

chmod 775 /etc/rc.d/init.d/tomcat

Turn tomcat into executable file

 

Register as a service, and self-start

carried out

chkconfig tomcat on

 

Restart the system to test

carried out

reboot

Published 18 original articles · won praise 5 · Views 3486

Guess you like

Origin blog.csdn.net/didixp/article/details/84104347