Tomcat5.5自启动的方法收集

Tomcat5.5自启动的两种方法:

方法一:


#!/bin/bash
#
# kenny [email protected]
# /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
fi

RETVAL=$?

export JAVA_HOME=/usr/java/jdk1.6.0_23     # JAVA_HOME 目录

export CATALINA_HOME="/usr/local/tomcat"    #CATALINA_HOME 目录

case "$1" 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: $0 {start|stop}"
        exit 1
        ;;
esac
exit $RETVAL

#chkconfig --add tomcat
#chkconfig --list tomcat
tomcat 0ff 1ff 2n 3n 4n 5n 6ff
启动tomcat
#service tomcat start
 

方法二:

编辑TOMCAT的启动脚本:
#vi +2 catalina.sh
在第二行加入以下内容:
# chkconfig: 2345 63 37
# description: tomcat server init script
export JAVA_HOME=/usr/local/java    # JAVA_HOME 目录
export CATALINA_HOME=/usr/local/tomcat   # CATALINA_HOME 目录
然后保存退出。
#cp catalina.sh /etc/rc.d/init.d/tomcat
#chkconfig --add tomcat
#chkconfig --list tomcat
tomcat 0ff 1ff 2n 3n 4n 5n 6ff
启动tomcat
#service tomcat start
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JAVA_HOME: /usr/local/java
测试tomcat是否启动
#netstat -an|grep 8080
tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN
停止tomcat
#service tomcat stop
 

 

我感觉第一个方法不错

参考:http://wenku.baidu.com/view/20f7b3d5b9f3f90f76c61bf2.html

          http://www.cjsdn.net/post/print?bid=11&id=171874

 

你可能感兴趣的:(职场,休闲,Tomcat5.5自启动的方法)