[packages/courier-authlib] cleanup functions in initscript
glen
glen at pld-linux.org
Thu Oct 29 13:41:59 CET 2015
commit 78fe65b950b5da5870197ed2681b16c27cc5d60c
Author: Elan Ruusamäe <glen at delfi.ee>
Date: Thu Oct 29 14:40:34 2015 +0200
cleanup functions in initscript
courier-authlib.init | 53 +++++++++++++++++++++++++++++-----------------------
1 file changed, 30 insertions(+), 23 deletions(-)
---
diff --git a/courier-authlib.init b/courier-authlib.init
index 0527ad4..6113933 100755
--- a/courier-authlib.init
+++ b/courier-authlib.init
@@ -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}"
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/courier-authlib.git/commitdiff/2376db480b3c97cfc6d9bcd87b5a5087864beeb4
More information about the pld-cvs-commit
mailing list