]> git.pld-linux.org Git - packages/apache-tomcat.git/commitdiff
- use functions
authorElan Ruusamäe <glen@pld-linux.org>
Fri, 3 Oct 2008 18:54:08 +0000 (18:54 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    apache-tomcat.init -> 1.9

apache-tomcat.init

index cbfba78de26fe89c9db380553ca45874eb57361c..ed8eccf668c43501e5edd1c085ab1088f8c6d8b7 100644 (file)
@@ -28,23 +28,25 @@ 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
                [ $? -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
@@ -55,11 +57,20 @@ case "$1" in
        else
                msg_not_running tomcat
        fi
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+       start
+       ;;
+  stop)
+       stop
        ;;
   restart|force-reload)
-       $0 stop
-       $0 start
-       exit $?
+       stop
+       start
        ;;
   status)
        echo "Not supported (yet?)"
@@ -71,6 +82,3 @@ case "$1" in
 esac
 
 exit $RETVAL
-
-# This must be last line !
-# vi:syntax=sh:tw=78:ts=8:sw=4
This page took 0.069237 seconds and 4 git commands to generate.