[Bug 562377] Re: Add status action to slapd init script

Mathias Gug mathiaz at ubuntu.com
Tue Apr 13 16:53:39 BST 2010


Here is the proposed patch:

(l)mathiaz at mathiaz-srv:~/src/openldap/pkg-branches/lucid.dev/debian$ bzr diff --old ../../lucid/ slapd.init
=== modified file 'debian/slapd.init'
--- debian/slapd.init   2009-08-11 14:48:56 +0000
+++ debian/slapd.init   2010-04-12 23:21:40 +0000
@@ -189,6 +189,27 @@
        echo .
 }
 
+# Check OpenLDAP status
+status_slapd() {
+       # No PID
+       if [ ! -f $SLAPD_PIDFILE ]; then
+               echo "OpenLDAP is NOT running"
+               exit 3
+       fi
+
+       # Bogus PID
+       for pid in $(cat $SLAPD_PIDFILE) ; do
+               if ! ps --noheaders p "$pid" | grep $SLAPD > /dev/null ; then
+                       echo "OpenLDAP is NOT running, bogus pidfile found: '$SLAPD_PIDFILE'"
+                       exit 1
+               fi
+       done
+
+       # Running PID
+       echo "OpenLDAP is running"
+       exit 0
+}
+
 case "$1" in
   start)
        check_for_no_start
@@ -200,8 +221,10 @@
        stop_ldap
        start_ldap
        ;;
+  status)
+       status_slapd ;;
   *)
-       echo "Usage: $0 {start|stop|restart|force-reload}"
+       echo "Usage: $0 {start|stop|restart|force-reload|status}"
        exit 1
        ;;
 esac


** Summary changed:

- Add status action to slapd init script
+ [FFe] Add status action to slapd init script

** Also affects: openldap (Ubuntu Lucid)
   Importance: Undecided
       Status: New

** Changed in: openldap (Ubuntu Lucid)
   Importance: Undecided => Low

** Changed in: openldap (Ubuntu Lucid)
       Status: New => Triaged

-- 
[FFe] Add status action to slapd init script
https://bugs.launchpad.net/bugs/562377
You received this bug notification because you are a member of Ubuntu
Server Team, which is subscribed to openldap in ubuntu.



More information about the Ubuntu-server-bugs mailing list