sleep 15
echo "Stopping the slave..."
-kill $SLAVEPID
+kill -HUP $SLAVEPID
KILLPIDS="$PID $SLURPPID"
echo "Waiting 5 seconds for slave slapd to die..."
sleep 5
-echo "Applying more changes..."
+echo "Applying more changes to the master slapd..."
$LDAPMODIFY -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD > \
$TESTOUT 2>&1 << EOMODS
dn: cn=James A Jones 1, ou=Alumni Association, ou=People, dc=example, dc=com
echo "Stopping slurpd..."
-kill $SLURPPID
+kill -HUP $SLURPPID
KILLPIDS="$PID"
echo "Waiting 5 seconds for slurpd to die..."
sleep 5
-echo "Applying more changes..."
+echo "Applying more changes to the master slapd..."
$LDAPMODIFY -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD > \
$TESTOUT 2>&1 << EOMODS
dn: cn=James A Jones 1, ou=Alumni Association, ou=People, dc=example, dc=com
fi
echo "Restarting slave slapd on TCP/IP port $PORT2..."
+echo "RESTART" >> $LOG2
$SLAPD -f $CONF2 -h $URI2 -d $LVL $TIMING >> $LOG2 2>&1 &
SLAVEPID=$!
if test $WAIT != 0 ; then
sleep 5
done
-echo "Starting slurpd..."
+echo "Restarting slurpd..."
+echo "RESTART" >> $SLURPLOG
$SLURPD -f $CONF1 -d ${SLURPD_DEBUG-5} -t $DBDIR1B >> $SLURPLOG 2>&1 &
SLURPPID=$!
if test $WAIT != 0 ; then
echo "Waiting 15 seconds for syncrepl to receive changes..."
sleep 15
+echo "Stopping the provider, sleeping 10 seconds and restarting it..."
+kill -HUP "$PID"
+sleep 10
+echo "RESTART" >> $LOG1
+$SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING >> $LOG1 2>&1 &
+PID=$!
+if test $WAIT != 0 ; then
+ echo PID $PID
+ read foo
+fi
+KILLPIDS="$PID $SLAVEPID"
+
+echo "Using ldapsearch to check that master slapd is running..."
+for i in 0 1 2 3 4 5; do
+ $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
+ 'objectclass=*' > /dev/null 2>&1
+ RC=$?
+ if test $RC = 0 ; then
+ break
+ fi
+ echo "Waiting 5 seconds for slapd to start..."
+ sleep 5
+done
+
+if test $RC != 0 ; then
+ echo "ldapsearch failed ($RC)!"
+ test $KILLSERVERS != no && kill -HUP $KILLPIDS
+ exit $RC
+fi
+
echo "Using ldapmodify to modify master directory..."
#