日期:2014-05-16 浏览次数:20732 次
#!/bin/sh # # Startup Script for Tomcat5 # # chkconfig: 345 87 13 # description: Tomcat Daemon # processname: jsvc # pidfile: /var/run/jsvc.pid # config: # # Source function library. . /etc/rc.d/init.d/functions # prog=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.6.0_27 CATALINA_HOME=/usr/local/tomcat DAEMON_HOME=$CATALINA_HOME/bin/jsvc-src TOMCAT_USER=root 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 # $DAEMON_HOME/jsvc \ -user $TOMCAT_USER \ -home $JAVA_HOME \ -Dcatalina.home=$CATALINA_HOME \ -Djava.io.tmpdir=$TMP_DIR \ -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 ] && touch /var/lock/subsys/jsvc [ $RETVAL = 0 ] && echo_success || echo_failure echo return $RETVAL } stop(){ echo -n $"Stopping $prog: " # # Stop Tomcat # PID=`cat /var/run/jsvc.pid` kill $PID RETVAL=$? [ $RETVAL = 0 ] && rm /var/lock/subsys/jsvc [ $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" exit 1;; esac