X-Git-Url: http://git.pld-linux.org/?a=blobdiff_plain;f=apache-tomcat.init;h=e3ae053d90249be69900bfe3e81b4472c04c076f;hb=2ab6ab5f341ab6e064d4b582e8ba700bafdfa6b3;hp=cbfba78de26fe89c9db380553ca45874eb57361c;hpb=7df33dd1390cf8ea919f6b9dd04257b17dda4fce;p=packages%2Ftomcat.git diff --git a/apache-tomcat.init b/apache-tomcat.init index cbfba78..e3ae053 100644 --- a/apache-tomcat.init +++ b/apache-tomcat.init @@ -28,49 +28,73 @@ else exit 0 fi -RETVAL=0 -# See how we were called. -case "$1" in - start) +start() { # Check if the service is already running? if [ ! -f /var/lock/subsys/tomcat ]; then msg_starting tomcat busy - su - http -s /bin/sh -c /usr/share/tomcat/bin/startup.sh >/dev/null 2>&1 + su tomcat -s /bin/sh -c '/usr/share/tomcat/bin/catalina.sh start' >/dev/null 2>&1 [ $? -ne 0 ] && RETVAL=1 - [ $RETVAL -eq 0 ] && ok || fail - [ $RETVAL -eq 0 ] && touch /var/lock/subsys/tomcat + if [ $RETVAL -eq 0 ]; then + ok + touch /var/lock/subsys/tomcat + else + fail + fi else msg_already_running tomcat fi - ;; - stop) +} + +stop() { if [ -f /var/lock/subsys/tomcat ]; then # Stop daemons. msg_stopping tomcat busy - su - http -s /bin/sh -c /usr/share/tomcat/bin/shutdown.sh >/dev/null 2>&1 + su tomcat -s /bin/sh -c '/usr/share/tomcat/bin/catalina.sh stop' >/dev/null 2>&1 [ $? -eq 0 ] && ok || fail rm -f /var/lock/subsys/tomcat else msg_not_running tomcat fi +} + +condrestart() { + if [ -f /var/lock/subsys/tomcat ]; then + stop + start + else + msg_not_running tomcat + RETVAL=$1 + fi +} + +RETVAL=0 +# See how we were called. +case "$1" in + start) + start ;; - restart|force-reload) - $0 stop - $0 start - exit $? + stop) + stop + ;; + restart) + stop + start + ;; + try-restart) + condrestart 0 + ;; + force-reload) + condrestart 7 ;; status) - echo "Not supported (yet?)" + status tomcat java RETVAL=0 ;; *) - msg_usage "$0 {start|stop|restart|force-reload|status}" + msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}" exit 3 esac exit $RETVAL - -# This must be last line ! -# vi:syntax=sh:tw=78:ts=8:sw=4