以下tomcat5启动脚本需要jsvc支持:

#!/bin/sh
# Startup Script for Tomcat5
#
# chkconfig: 345 88 14
# description: Tomcat Daemon
# processname: jsvc
# pidfile: /var/run/jsvc.pid
# config:
#
# That is for Tomcat-5.0.x (Apache Tomcat/5.0)
#
# Source function library.
. /etc/init.d/functions
#
prog=tomcat
#
JAVA_HOME=/usr/local/java
CATALINA_HOME=/usr/local/tomcat
DAEMON_HOME=/usr/local/tomcat/bin
#TOMCAT_USER=tomcat5
TOMCAT_USER=root

# for multi instances adapt those lines.
TMP_DIR=/tmp
PID_FILE=/var/run/tomcat/jsvc.pid
CATALINA_BASE=/usr/local/tomcat

CATALINA_OPTS=” -Xms512m -Xmx2300m “
CLASSPATH=
JAVA_HOME/lib/tools.jar:
CATALINA_HOME/bin/commons-daemon.jar:
CATALINA_HOME/bin/bootstrap.jar

start() {
    #
    # Start Tomcat
    #
    echo -n ”Starting prog: “
    DAEMON_HOME/jsvc-src/jsvc
    -user TOMCAT_USER
    -home JAVA_HOME
    -Dcatalina.home=CATALINA_HOME
    -Dcatalina.base=CATALINA_BASE
    -Djava.io.tmpdir=TMP_DIR
    -wait 15
    -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
    if [ ? -eq 0 ]; then
        success; echo
    else
        failure; echo
    fi
}

stop() {
    #
    # Stop Tomcat
    #
    echo -n ”Stopping prog: “
    DAEMON_HOME/jsvc-src/jsvc
    -stop
    -pidfile PID_FILE
    org.apache.catalina.startup.Bootstrap
    #PID=cat PID_FILE
    #kill -9 PID
    if [ ? -eq 0 ]; then
        success; echo
    else
        failure; echo
    fi
}

case “1” in
  start)
    # Start Tomcat
    start
    ;;

  stop)
    # Stop Tomcat
    stop
    ;;

  restart)
    # Restart Tomcat
    stop
    start
    ;;
  *)
    echo “Usage: prog {start|stop|restart}    exit 1;;
esac