[FFe] Add status action to slapd init script

Bug #562377 reported by Mathias Gug
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
openldap (Ubuntu)
Fix Released
Low
Unassigned
Lucid
Fix Released
Low
Unassigned

Bug Description

As reported in bug 556176:

While playing with slapd and Corosync/Pacemaker cluster stuff, I discovered the slapd init script doesn' t have a status function. I'm trying to create a working OCF compatible script (with monitor stuff) but for now I'm using the default LSB init function for testing. The attached patch adds some simple status checking with LSB compatible exit codes which may be usefull for other purposes.

Revision history for this message
Mathias Gug (mathiaz) wrote :
Revision history for this message
Mathias Gug (mathiaz) wrote :

Here is the proposed patch:

(l)mathiaz@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: - Add status action to slapd init script
+ [FFe] Add status action to slapd init script
Changed in openldap (Ubuntu Lucid):
importance: Undecided → Low
status: New → Triaged
Revision history for this message
Scott Kitterman (kitterman) wrote :

FFe approved. Please go ahead.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package openldap - 2.4.21-0ubuntu4

---------------
openldap (2.4.21-0ubuntu4) lucid; urgency=low

  [ Simon Olofsson ]
  * debian/slapd.postinst:
    - Show a message after successful migration (LP: #538848)

  [ Jorgen Rosink ]
  * debian/slapd.init: add simple status checking with LSB compatible exit
    codes (LP: #562377)
  * debian/slapd.init.ldif:
    - remove admin user in default config database (LP: #556176)
    - in default config, add olcAccess entries giving access to controls
      available and cn=subschema (LP: #427842)

  [ Scott Moser ]
  * debian/slapd.scripts-common: Do not create /nonexistent directory
     for openldap user's home (LP: #556176)
  * debian/slapd.postinst: fix cn=config olcAccess migration (LP: #559070)
 -- Scott Moser <email address hidden> Mon, 12 Apr 2010 16:16:47 -0400

Changed in openldap (Ubuntu Lucid):
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.