]> git.pld-linux.org Git - packages/anubis.git/commitdiff
- use functions
authorJakub Bogusz <qboosh@pld-linux.org>
Sat, 1 Dec 2007 00:25:41 +0000 (00:25 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
- force-reload is not supposed to start service if not running
- added try-reload action (LSB 3.1)

Changed files:
    anubis.init -> 1.8

anubis.init

index edc44a44bf3f00b95dc5f5f9b18bf41a6436e1b2..1de054b17f69ab36058b8bb5a2c957d75933942d 100644 (file)
@@ -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.08749 seconds and 4 git commands to generate.