]> git.pld-linux.org Git - packages/apache-tomcat.git/blobdiff - apache-tomcat.init
- add status
[packages/apache-tomcat.git] / apache-tomcat.init
index 364941cd4eb0958bbcfd8f01d2a3de194a5c821f..e3ae053d90249be69900bfe3e81b4472c04c076f 100644 (file)
@@ -20,8 +20,7 @@
 
 # Check that networking is up.
 if is_yes "${NETWORKING}"; then
-       if [ ! -f /var/lock/subsys/network -a != stop -a != status ]; then
-               # nls "ERROR: Networking is down. %s can't be run." <service>
+       if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
                msg_network_down tomcat
                exit 1
        fi
@@ -29,54 +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
-               # show "Starting %s service" tomcat
                msg_starting tomcat
                busy
-               su - http -s /bin/sh -c /usr/lib/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
-               # show "%s service is already running." tomcat
                msg_already_running tomcat
        fi
-       ;;
-  stop)
+}
+
+stop() {
        if [ -f /var/lock/subsys/tomcat ]; then
                # Stop daemons.
-               # show "Stopping %s service" tomcat
                msg_stopping tomcat
                busy
-               su - http -s /bin/sh -c /usr/lib/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
-               # show "%s service is not running." tomcat
                msg_not_running tomcat
-       fi      
+       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
        ;;
   *)
-       # show "Usage: %s {start|stop|restart|force-reload|status}"
-       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
This page took 0.059896 seconds and 4 git commands to generate.