]> git.pld-linux.org Git - packages/anubis.git/blobdiff - anubis.init
- for 4.1
[packages/anubis.git] / anubis.init
index 1793af22ecf0c0877aba9c5d466507b0431ff0ac..1de054b17f69ab36058b8bb5a2c957d75933942d 100644 (file)
@@ -21,7 +21,7 @@ PROG=$SERVICE
 
 # Check that networking is up
 if is_yes "${NETWORKING}"; then
-       if [ ! -f /var/lock/subsys/network ]; then
+       if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
                msg_network_down $MSG
                exit 1
        fi
@@ -32,10 +32,7 @@ fi
 # Get service config
 [ -f "/etc/sysconfig/$SERVICE" ] && . "/etc/sysconfig/$SERVICE"
 
-RETVAL=0
-# See how we were called.
-case "$1" in
-  start)
+start() {
        if [ ! -f "$LOCKFILE" ]; then
                msg_starting "$MSG"
                daemon $PROG
@@ -44,8 +41,9 @@ case "$1" in
        else
                msg_already_running $MSG
        fi
-       ;;
-  stop)
+}
+
+stop() {
        if [ -f "$LOCKFILE" ]; then
                msg_stopping "$MSG"
                killproc $PROG
@@ -53,16 +51,41 @@ case "$1" in
        else
                msg_not_running "$MSG"
        fi
+}
+
+condrestart() {
+       if [ -f "$LOCKFILE" ]; then
+               stop
+               start
+       else
+               msg_not_running "$MSG"
+               RETVAL=$1
+       fi
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+       start
+       ;;
+  stop)
+       stop
+       ;;
+  restart)
+       stop
+       start
+       ;;
+  try-restart)
+       condrestart 0
+       ;;
+  force-reload)
+       condrestart 7
        ;;
   status)
        status $PROG
        exit $?
        ;;
-  restart|force-reload)
-       $0 stop
-       $0 start
-       exit $?
-       ;;
   *)
        msg_usage "$0 {start|stop|restart|force-reload|status}"
        exit 3
This page took 0.088165 seconds and 4 git commands to generate.