[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#659667: debian-edu-config: ldapdump.sh stops slapd at night and fail to start it



[Petter Reinholdtsen]
> I suspect slapd fail to restart only when stopping it failed, but
> have not yet verified it.  If this is true, the problem only happen
> some nights, which match what I am seeing.  Some race issue?

I'm still unable to reliably reproduce the problem, and have no idea
what causes it.  But the attached patch might help, by making
ldapdump.sh more presistent in stopping and starting slapd.

Anyone got a better idea?
-- 
Happy hacking
Petter Reinholdtsen
Index: debian/changelog
===================================================================
--- debian/changelog	(revisjon 76276)
+++ debian/changelog	(arbeidskopi)
@@ -4,6 +4,8 @@
   * Make sure to syslog when ldapdump.sh is starting and stopping slapd,
     to make it easier to figure out what caused it if slapd fail to
     start.  Related to bug #659667.
+  * Make sure ldapdump.sh try 5 times to stop and start slapd, to reduce the
+    chance of ending up without an LDAP server.
 
  -- Petter Reinholdtsen <pere@debian.org>  Mon, 13 Feb 2012 18:03:45 +0100
 
Index: share/debian-edu-config/tools/ldapdump.sh
===================================================================
--- share/debian-edu-config/tools/ldapdump.sh	(revisjon 76276)
+++ share/debian-edu-config/tools/ldapdump.sh	(arbeidskopi)
@@ -25,11 +25,21 @@
 # do the LDAP-databasedump (slapcat)
 if [ -x /etc/init.d/slapd -a -x /usr/sbin/slapcat ]; then
     logger -t ldapdump.sh "stopping slapd to back up the database"
-    /etc/init.d/slapd stop
+    count=5
+    while /etc/init.d/slapd status && [ 0 -gt $count ] ; do
+	/etc/init.d/slapd stop
+	sleep 1
+	count=$(($count - 1))
+    done
     /usr/sbin/slapcat -l $TMPDUMPFILE
     SCRETVAL=$?
     logger -t ldapdump.sh "starting slapd after backing up the database"
-    /etc/init.d/slapd start
+    count=5
+    while ! /etc/init.d/slapd status && [ 0 -gt $count ]; do
+	/etc/init.d/slapd start
+	sleep 1
+	count=$(($count - 1))
+    done
     if [ ! $SCRETVAL -eq 0 ]; then
 	echo "/usr/sbin/slapcat failed, bailing out."
 	exit 1

Reply to: