#!/bin/bash
# Tomcat 5 init script for Fedora 2
#
# chkconfig: - 80 20 
# description: tomcat

export CATALINA_HOME=/opt/tomcat
export JAVA_HOME=/usr/java/j2sdk1.4.2_05
start_tomcat=$CATALINA_HOME/bin/startup.sh
stop_tomcat=$CATALINA_HOME/bin/shutdown.sh

start() {
echo -n "Starting tomcat: "
#su -c ${start_tomcat} - tomcat
${start_tomcat}
echo "done."
}
stop() {
echo -n "Shutting down tomcat: "
${stop_tomcat}
echo "done."
}

# See how we were called
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
sleep 10
start
;;
*)
echo "Usage: $0 {start|stop|restart}"
esac

exit 0
