]> git.pld-linux.org Git - packages/apache-tomcat.git/blobdiff - apache-tomcat.init
- BUILDS, so cleaning up
[packages/apache-tomcat.git] / apache-tomcat.init
index ce64eea9cc37d28ff3d430c45d6f6130143cf0dd..5e97bb4185d3b075f943004ba3e29f28d429724e 100644 (file)
@@ -20,8 +20,7 @@
 
 # Check that networking is up.
 if is_yes "${NETWORKING}"; then
-       if [ ! -f /var/lock/subsys/network ]; 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,60 +28,46 @@ else
        exit 0
 fi
 
+RETVAL=0
 # See how we were called.
 case "$1" in
   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
-               RETVAL=$?
-               if [ $RETVAL -eq 0 ]; then
-                       ok
-               else
-                       fail
-               fi
+               [ $? -ne 0 ] && RETVAL=1
+               [ $RETVAL -eq 0 ] && ok || fail
                [ $RETVAL -eq 0 ] && touch /var/lock/subsys/tomcat
        else
-               # show "%s service is already running." tomcat
                msg_already_running tomcat
-               exit 1
        fi
-        ;;
+       ;;
   stop)
-        # Stop daemons.
-        # show "Stopping %s service" tomcat
        if [ -f /var/lock/subsys/tomcat ]; then
+               # Stop daemons.
                msg_stopping tomcat
                busy
                su - http -s /bin/sh -c /usr/lib/tomcat/bin/shutdown.sh >/dev/null 2>&1
-               RETVAL=$?
-               if [ $RETVAL -eq 0 ]; then
-                       ok
-               else
-                       fail
-               fi
+               [ $? -eq 0 ] && ok || fail
                rm -f /var/lock/subsys/tomcat
        else
-               # show "%s service is not running." tomcat
                msg_not_running tomcat
-               exit 1
-       fi      
-        ;;
-  restart|reload|force-reload)
-        $0 stop
+       fi
+       ;;
+  restart|force-reload)
+       $0 stop
        $0 start
-        ;;
+       exit $?
+       ;;
   status)
        echo "Not supported (yet?)"
        RETVAL=0
-        ;;
+       ;;
   *)
-        # show "Usage: %s {start|stop|status|restart|reload|force-reload}" $0
-       msg_usage "$0 {start|stop|status|restart|reload|force-reload}"
-        exit 1
+       msg_usage "$0 {start|stop|restart|force-reload|status}"
+       exit 3
 esac
 
 exit $RETVAL
This page took 0.092585 seconds and 4 git commands to generate.