# This is the init script for starting up the # Jakarta Tomcat server # # chkconfig: 345 91 10 # description: Starts and stops the Tomcat daemon. ## Source function library. . /etc/init.d/functions# Get config. #. /etc/sysconfig/network# Check that networking is up. #[ "${NETWORKING}" = "no" ] && exit 0umask 077start(){ echo -n $"Starting Tomcat service: " export JAVA_HOME="/usr/java/jdk1.5.0_08" daemon /usr/java/apache-tomcat-5.5.17/bin/startup.sh RETVAL=$? echo }stop(){ echo -n $"Stopping Tomcat service: " export JAVA_HOME="/usr/java/jdk1.5.0_08" daemon /usr/java/apache-tomcat-5.5.17/bin/shutdown.sh RETVAL=$? echo }status(){ numproc=`ps -ef | grep tomcat | grep -v "grep itomcat" | wc -l` if [ $numproc -gt 0 ]; then echo "Tomcat is running..." else echo "Tomcat is stopped..." fi }restart(){ stop start } # See how we were called. case "$1" in start) start ;; stop) stop ;; status) status ;; restart|reload) restart ;; *) echo $"Usage: $0 {start|stop|status|restart}" exit 1 esacexit 0