Tomcat5 守护进程脚本

#!/bin/sh
#
# Startup Script. for Tomcat5
#
# chkconfig: 345 87 13
# description: Tomcat Daemon
# processname: jsvc
# config:
#
# Source function library.
. /etc/rc.d/init.d/functions
#
prog="Apache Tomcat" 
#
# Small shell script. to show how to start/stop Tomcat using jsvc
# If you want to have Tomcat running on port 80 please modify the server.xml
# file:
#
# <!-- Define a non-SSL HTTP/1.1 Connector on port 80 -->
# <Connector className="org.apache.catalina.connector.http.HttpConnector"
# port="80" minProcessors="5" maxProcessors="75"
# enableLookups="true" redirectPort="8443"
# acceptCount="10" debug="0" connectionTimeout="60000"/>
#
# You need a developement version of Tomcat (Apache Tomcat/4.1-dev)
#
# Adapt the following lines to your configuration

JAVA_HOME=/usr/java/jdk1.5

JAVA_OPTS="-Xms256m -Xmx256m -XX:MaxNewSize=512m -XX:MaxPermSize=512m"

CATALINA_HOME=/home/tomcat/svrside
DAEMON_HOME=$CATALINA_HOME/bin/jsvc-src
PID_FILE=/var/run/jsvc.pid
TOMCAT_USER=tomcat
TMP_DIR=/var/tmp
CATALINA_OPTS=
CLASSPATH=\
$JAVA_HOME/lib/tools.jar:\
$CATALINA_HOME/bin/commons-daemon.jar:\
$CATALINA_HOME/bin/bootstrap.jar

start(){
echo -n $"Starting $prog: "
    #
    # Start Tomcat

    #
    # whitout this parameter, BIRT(2.2.2) always can't show popup dialog
    # -Djava.awt.headless=true \

    $DAEMON_HOME/jsvc \
    -user $TOMCAT_USER \
    -home $JAVA_HOME $JAVA_OPTS\
    -Dcatalina.home=$CATALINA_HOME \
    -Djava.io.tmpdir=$TMP_DIR \
    -wait 10 \
    -pidfile $PID_FILE \
    -outfile $CATALINA_HOME/logs/catalina.out \
    -errfile '&1' \
    $CATALINA_OPTS \
    -cp $CLASSPATH \
    org.apache.catalina.startup.Bootstrap
    #
    # To get a verbose JVM
    #-verbose \
    # To get a debug of jsvc.
    #-debug \
    RETVAL=$?
    [ $RETVAL = 0 ] && echo_success || echo_failure
    echo
    return $RETVAL
}
stop(){
    echo -n $"Stopping $prog: "
    #
    # Stop Tomcat
    #
    $DAEMON_HOME/jsvc \
    -stop \
    -pidfile $PID_FILE \
    org.apache.catalina.startup.Bootstrap
    RETVAL=$?
    [ $RETVAL = 0 ] && echo_success || echo_failure
    echo
    return $RETVAL
}

case "$1" in
start)
start
;;

stop)
stop
;;

restart|reload)
stop
start
;;

*)
echo "Usage $0 start/stop/restart/reload"
exit 1;;
esac

你可能感兴趣的:(java,apache,jvm,tomcat,脚本)