]> git.pld-linux.org Git - packages/openldap.git/commitdiff
- use functions
authorJakub Bogusz <qboosh@pld-linux.org>
Fri, 4 Jan 2008 21:58:21 +0000 (21:58 +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-restart action (LSB 3.1)

Changed files:
    ldap.init -> 1.29

ldap.init

index bb00d000fa62462f5c96e77dabb024e7c45e71a3..8f30e1272eba9ee8b1ed072baeed2a1075677bb0 100644 (file)
--- a/ldap.init
+++ b/ldap.init
@@ -34,11 +34,7 @@ else
        exit 0
 fi
 
-RETVAL=0
-# See how we were called.
-case "$1" in
-  start)
-       # Check if the service is already running?
+start() {
        if [ ! -f /var/lock/subsys/ldap ]; then
                msg_starting "OpenLDAP"
                ARGS="-u slapd -g slapd"
@@ -62,8 +58,9 @@ case "$1" in
        else
                msg_already_running "OpenLDAP"
        fi
-       ;;
-  stop)
+}
+
+stop() {
        if [ -f /var/lock/subsys/ldap ]; then
                msg_stopping "OpenLDAP"
                killproc --waitforname slapd --waitfortime 300 slapd -TERM
@@ -71,18 +68,43 @@ case "$1" in
        else
                msg_not_running "OpenLDAP"
        fi
+}
+
+condrestart() {
+       if [ -f /var/lock/subsys/ldap ]; then
+               stop
+               start
+       else
+               msg_not_running "OpenLDAP"
+               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 slapd
        RETVAL=$?
        ;;
-  restart|force-reload)
-       $0 stop
-       $0 start
-       exit $?
-       ;;
   *)
-       msg_usage "$0 {start|stop|restart|force-reload|status}"
+       msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
        exit 3
 esac
 
This page took 0.114811 seconds and 4 git commands to generate.