aboutsummaryrefslogtreecommitdiff
path: root/net/openldap24-server/files/patch-tests::scripts::test018-syncreplication-persist
blob: 2325aef08a3af3446a3665b2e3050881978d83c9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
--- tests/scripts/test018-syncreplication-persist	Mon Oct  6 16:57:32 2003
+++ tests/scripts/test018-syncreplication-persist	Sun Oct 19 15:33:58 2003
@@ -44,9 +44,6 @@
 fi
 BACKEND=$SAVE
 
-echo "Waiting 5 seconds to wait for master to start..."
-sleep 5
-
 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 $PORT \
@@ -59,22 +56,28 @@
 	sleep 5
 done
 
+if test $RC != 0 ; then
+	echo "ldapsearch failed ($RC)!"
+	kill -HUP $PID
+	exit $RC
+fi
+
 echo "Using ldapadd to create the context prefix entry in the master..."
 $LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT -w $PASSWD < \
 	$LDIFORDEREDCP > /dev/null 2>&1
 RC=$?
 if test $RC != 0 ; then
 	echo "ldapadd failed ($RC)!"
-	kill -HUP $PID $SLAVEPID
+	kill -HUP $PID
 	exit $RC
 fi
 
 echo "Starting slave slapd on TCP/IP port $P1SLAVEPORT..."
 . $CONFFILTER $BACKEND $MONITORDB < $P1SRSLAVECONF > $P1REPLCONF
 $SLAPD -f $P1REPLCONF -h $P1SLAVEURI -d $LVL $TIMING > $P1SLAVELOG 2>&1 &
-P1SLAVEPID=$!
+SLAVEPID=$!
 if test $WAIT != 0 ; then
-    echo SLAVEPID $P1SLAVEPID
+    echo SLAVEPID $SLAVEPID
     read foo
 fi
 
@@ -90,6 +93,12 @@
 	sleep 5
 done
 
+if test $RC != 0 ; then
+	echo "ldapsearch failed ($RC)!"
+	kill -HUP $PID $SLAVEPID
+	exit $RC
+fi
+
 echo "Using ldapadd to populate the master directory..."
 $LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT -w $PASSWD < \
 	$LDIFORDEREDNOCP > /dev/null 2>&1
@@ -203,11 +212,11 @@
 
 if test $RC != 0 ; then
 	echo "ldapsearch failed at slave ($RC)!"
-	kill -HUP $PID $P1SLAVEPID
+	kill -HUP $PID $SLAVEPID
 	exit $RC
 fi
 
-kill -HUP $PID $P1SLAVEPID
+kill -HUP $PID $SLAVEPID
 
 SEARCHOUT=$MASTEROUT
 LDIF=$P1SLAVEOUT