]> git.pld-linux.org Git - packages/courier-authlib.git/commitdiff
cleanup functions in initscript
authorElan Ruusamäe <glen@delfi.ee>
Thu, 29 Oct 2015 12:40:34 +0000 (14:40 +0200)
committerElan Ruusamäe <glen@delfi.ee>
Thu, 29 Oct 2015 12:40:34 +0000 (14:40 +0200)
courier-authlib.init

index 0527ad4ca28f837747ebdfbbff2191a0a249eaab..6113933cd671bcb81121c4248dd04077430665b0 100755 (executable)
@@ -27,25 +27,39 @@ fi
 
 start() {
        # Check if the service is already running?
-       if [ ! -f /var/lock/subsys/courier-authlib ]; then
-               msg_starting courier-authlib
-               daemon /usr/sbin/authdaemond start
-               RETVAL=$?
-               [ $RETVAL -eq 0 ] && touch /var/lock/subsys/courier-authlib
-       else
+       if [ -f /var/lock/subsys/courier-authlib ]; then
                msg_already_running courier-authlib
+               return
        fi
+
+       msg_starting courier-authlib
+       daemon /usr/sbin/authdaemond start
+       RETVAL=$?
+       [ $RETVAL -eq 0 ] && touch /var/lock/subsys/courier-authlib
 }
 
 stop() {
        # Stop daemons.
-       if [ -f /var/lock/subsys/courier-authlib ]; then
-               msg_stopping courier-authlib
-               daemon /usr/sbin/authdaemond stop
-               rm -f /var/lock/subsys/courier-authlib >/dev/null 2>&1
-       else
+       if [ ! -f /var/lock/subsys/courier-authlib ]; then
                msg_not_running courier-authlib
+               return
        fi
+
+       msg_stopping courier-authlib
+       daemon /usr/sbin/authdaemond stop
+       rm -f /var/lock/subsys/courier-authlib >/dev/null 2>&1
+}
+
+reload() {
+       if [ ! -f /var/lock/subsys/courier-authlib ]; then
+               msg_not_running courier-authlib
+               RETVAL=7
+               return
+       fi
+
+       msg_reloading courier-authlib
+       daemon /usr/sbin/authdaemond restart
+       RETVAL=$?
 }
 
 RETVAL=0
@@ -57,23 +71,16 @@ case "$1" in
   stop)
        stop
        ;;
-  status)
-       status authdaemond
-       RETVAL=$?
-       ;;
   restart)
        stop
        start
        ;;
   reload|force-reload|graceful)
-       if [ -f /var/lock/subsys/courier-authlib ]; then
-               msg_reloading courier-authlib
-               daemon /usr/sbin/authdaemond restart
-               RETVAL=$?
-       else
-               msg_not_running courier-authlib
-               RETVAL=7
-       fi
+       reload
+       ;;
+  status)
+       status authdaemond
+       RETVAL=$?
        ;;
   *)
        msg_usage "$0 {start|stop|restart|reload|force-reload|graceful|status}"
This page took 0.111909 seconds and 4 git commands to generate.