mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-21 03:10:25 +08:00
Tweak startup, exiting
This commit is contained in:
parent
b144ca2169
commit
d33e095799
@ -75,9 +75,9 @@ fi
|
|||||||
echo "Starting slave slapd on TCP/IP port $R1SLAVEPORT..."
|
echo "Starting slave slapd on TCP/IP port $R1SLAVEPORT..."
|
||||||
. $CONFFILTER $BACKEND $MONITORDB < $R1SRSLAVECONF > $R1REPLCONF
|
. $CONFFILTER $BACKEND $MONITORDB < $R1SRSLAVECONF > $R1REPLCONF
|
||||||
$SLAPD -f $R1REPLCONF -h $R1SLAVEURI -d $LVL $TIMING > $R1SLAVELOG 2>&1 &
|
$SLAPD -f $R1REPLCONF -h $R1SLAVEURI -d $LVL $TIMING > $R1SLAVELOG 2>&1 &
|
||||||
R1SLAVEPID=$!
|
SLAVEPID=$!
|
||||||
if test $WAIT != 0 ; then
|
if test $WAIT != 0 ; then
|
||||||
echo SLAVEPID $R1SLAVEPID
|
echo SLAVEPID $SLAVEPID
|
||||||
read foo
|
read foo
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -105,7 +105,7 @@ $LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT -w $PASSWD < \
|
|||||||
RC=$?
|
RC=$?
|
||||||
if test $RC != 0 ; then
|
if test $RC != 0 ; then
|
||||||
echo "ldapadd failed ($RC)!"
|
echo "ldapadd failed ($RC)!"
|
||||||
kill -HUP $PID $R1SLAVEPID
|
kill -HUP $PID $SLAVEPID
|
||||||
exit $RC
|
exit $RC
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -201,7 +201,7 @@ RC=$?
|
|||||||
|
|
||||||
if test $RC != 0 ; then
|
if test $RC != 0 ; then
|
||||||
echo "ldapsearch failed at master ($RC)!"
|
echo "ldapsearch failed at master ($RC)!"
|
||||||
kill -HUP $PID $R1SLAVEPID
|
kill -HUP $PID $SLAVEPID
|
||||||
exit $RC
|
exit $RC
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -212,11 +212,11 @@ RC=$?
|
|||||||
|
|
||||||
if test $RC != 0 ; then
|
if test $RC != 0 ; then
|
||||||
echo "ldapsearch failed at slave ($RC)!"
|
echo "ldapsearch failed at slave ($RC)!"
|
||||||
kill -HUP $PID $R1SLAVEPID
|
kill -HUP $PID $SLAVEPID
|
||||||
exit $RC
|
exit $RC
|
||||||
fi
|
fi
|
||||||
|
|
||||||
kill -HUP $PID $R1SLAVEPID
|
kill -HUP $PID $SLAVEPID
|
||||||
|
|
||||||
SEARCHOUT=$MASTEROUT
|
SEARCHOUT=$MASTEROUT
|
||||||
LDIF=$R1SLAVEOUT
|
LDIF=$R1SLAVEOUT
|
||||||
|
@ -44,9 +44,6 @@ if test $WAIT != 0 ; then
|
|||||||
fi
|
fi
|
||||||
BACKEND=$SAVE
|
BACKEND=$SAVE
|
||||||
|
|
||||||
echo "Waiting 5 seconds to wait for master to start..."
|
|
||||||
sleep 5
|
|
||||||
|
|
||||||
echo "Using ldapsearch to check that master slapd is running..."
|
echo "Using ldapsearch to check that master slapd is running..."
|
||||||
for i in 0 1 2 3 4 5; do
|
for i in 0 1 2 3 4 5; do
|
||||||
$LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT \
|
$LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT \
|
||||||
@ -59,22 +56,28 @@ for i in 0 1 2 3 4 5; do
|
|||||||
sleep 5
|
sleep 5
|
||||||
done
|
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..."
|
echo "Using ldapadd to create the context prefix entry in the master..."
|
||||||
$LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT -w $PASSWD < \
|
$LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT -w $PASSWD < \
|
||||||
$LDIFORDEREDCP > /dev/null 2>&1
|
$LDIFORDEREDCP > /dev/null 2>&1
|
||||||
RC=$?
|
RC=$?
|
||||||
if test $RC != 0 ; then
|
if test $RC != 0 ; then
|
||||||
echo "ldapadd failed ($RC)!"
|
echo "ldapadd failed ($RC)!"
|
||||||
kill -HUP $PID $SLAVEPID
|
kill -HUP $PID
|
||||||
exit $RC
|
exit $RC
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Starting slave slapd on TCP/IP port $P1SLAVEPORT..."
|
echo "Starting slave slapd on TCP/IP port $P1SLAVEPORT..."
|
||||||
. $CONFFILTER $BACKEND $MONITORDB < $P1SRSLAVECONF > $P1REPLCONF
|
. $CONFFILTER $BACKEND $MONITORDB < $P1SRSLAVECONF > $P1REPLCONF
|
||||||
$SLAPD -f $P1REPLCONF -h $P1SLAVEURI -d $LVL $TIMING > $P1SLAVELOG 2>&1 &
|
$SLAPD -f $P1REPLCONF -h $P1SLAVEURI -d $LVL $TIMING > $P1SLAVELOG 2>&1 &
|
||||||
P1SLAVEPID=$!
|
SLAVEPID=$!
|
||||||
if test $WAIT != 0 ; then
|
if test $WAIT != 0 ; then
|
||||||
echo SLAVEPID $P1SLAVEPID
|
echo SLAVEPID $SLAVEPID
|
||||||
read foo
|
read foo
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -90,6 +93,12 @@ for i in 0 1 2 3 4 5; do
|
|||||||
sleep 5
|
sleep 5
|
||||||
done
|
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..."
|
echo "Using ldapadd to populate the master directory..."
|
||||||
$LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT -w $PASSWD < \
|
$LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT -w $PASSWD < \
|
||||||
$LDIFORDEREDNOCP > /dev/null 2>&1
|
$LDIFORDEREDNOCP > /dev/null 2>&1
|
||||||
@ -203,11 +212,11 @@ RC=$?
|
|||||||
|
|
||||||
if test $RC != 0 ; then
|
if test $RC != 0 ; then
|
||||||
echo "ldapsearch failed at slave ($RC)!"
|
echo "ldapsearch failed at slave ($RC)!"
|
||||||
kill -HUP $PID $P1SLAVEPID
|
kill -HUP $PID $SLAVEPID
|
||||||
exit $RC
|
exit $RC
|
||||||
fi
|
fi
|
||||||
|
|
||||||
kill -HUP $PID $P1SLAVEPID
|
kill -HUP $PID $SLAVEPID
|
||||||
|
|
||||||
SEARCHOUT=$MASTEROUT
|
SEARCHOUT=$MASTEROUT
|
||||||
LDIF=$P1SLAVEOUT
|
LDIF=$P1SLAVEOUT
|
||||||
|
@ -39,13 +39,14 @@ rm -rf $P3REPLDIR
|
|||||||
mkdir $P3REPLDIR
|
mkdir $P3REPLDIR
|
||||||
|
|
||||||
SAVE=$BACKEND
|
SAVE=$BACKEND
|
||||||
if test $BACKEND = ldbm; then
|
|
||||||
if test $SYNCREPL = no; then
|
if test $SYNCREPL = no; then
|
||||||
|
if test $BACKEND = ldbm; then
|
||||||
echo "Sync replication requires back-bdb or back-hdb"
|
echo "Sync replication requires back-bdb or back-hdb"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
BACKEND=$SYNCREPL
|
SYNCREPL=$BACKEND
|
||||||
fi
|
fi
|
||||||
|
BACKEND=$SYNCREPL
|
||||||
echo "Starting master slapd on TCP/IP port $PORT..."
|
echo "Starting master slapd on TCP/IP port $PORT..."
|
||||||
. $CONFFILTER $BACKEND $MONITORDB < $SRMASTERCONF > $DBCONF
|
. $CONFFILTER $BACKEND $MONITORDB < $SRMASTERCONF > $DBCONF
|
||||||
$SLAPD -f $DBCONF -h $MASTERURI -d $LVL $TIMING > $MASTERLOG 2>&1 &
|
$SLAPD -f $DBCONF -h $MASTERURI -d $LVL $TIMING > $MASTERLOG 2>&1 &
|
||||||
@ -54,12 +55,8 @@ if test $WAIT != 0 ; then
|
|||||||
echo PID $PID
|
echo PID $PID
|
||||||
read foo
|
read foo
|
||||||
fi
|
fi
|
||||||
BACKEND=$SAVE
|
|
||||||
|
|
||||||
echo "Waiting 5 seconds to wait for master to start..."
|
echo "Using ldapsearch to check that master slapd PID $PID is running..."
|
||||||
sleep 5
|
|
||||||
|
|
||||||
echo "Using ldapsearch to check that master slapd is running..."
|
|
||||||
for i in 0 1 2 3 4 5; do
|
for i in 0 1 2 3 4 5; do
|
||||||
$LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT \
|
$LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT \
|
||||||
'objectclass=*' > /dev/null 2>&1
|
'objectclass=*' > /dev/null 2>&1
|
||||||
@ -71,6 +68,12 @@ for i in 0 1 2 3 4 5; do
|
|||||||
sleep 5
|
sleep 5
|
||||||
done
|
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..."
|
echo "Using ldapadd to create the context prefix entry in the master..."
|
||||||
$LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT -w $PASSWD < \
|
$LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT -w $PASSWD < \
|
||||||
$LDIFORDEREDCP > /dev/null 2>&1
|
$LDIFORDEREDCP > /dev/null 2>&1
|
||||||
@ -81,14 +84,6 @@ if test $RC != 0 ; then
|
|||||||
exit $RC
|
exit $RC
|
||||||
fi
|
fi
|
||||||
|
|
||||||
SAVE=$BACKEND
|
|
||||||
if test $BACKEND = ldbm; then
|
|
||||||
if test $SYNCREPL = no; then
|
|
||||||
echo "Sync replication requires back-bdb or back-hdb"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
BACKEND=$SYNCREPL
|
|
||||||
fi
|
|
||||||
echo "Starting R1 slave slapd on TCP/IP port $R1SLAVEPORT..."
|
echo "Starting R1 slave slapd on TCP/IP port $R1SLAVEPORT..."
|
||||||
. $CONFFILTER $BACKEND $MONITORDB < $R1SRSLAVECONF > $R1REPLCONF
|
. $CONFFILTER $BACKEND $MONITORDB < $R1SRSLAVECONF > $R1REPLCONF
|
||||||
$SLAPD -f $R1REPLCONF -h $R1SLAVEURI -d $LVL $TIMING > $R1SLAVELOG 2>&1 &
|
$SLAPD -f $R1REPLCONF -h $R1SLAVEURI -d $LVL $TIMING > $R1SLAVELOG 2>&1 &
|
||||||
@ -97,9 +92,8 @@ if test $WAIT != 0 ; then
|
|||||||
echo SLAVE R1 PID $R1SLAVEPID
|
echo SLAVE R1 PID $R1SLAVEPID
|
||||||
read foo
|
read foo
|
||||||
fi
|
fi
|
||||||
BACKEND=$SAVE
|
|
||||||
|
|
||||||
echo "Using ldapsearch to check that R1 slave slapd is running..."
|
echo "Using ldapsearch to check that R1 slave slapd PID $R1SLAVEPID is running..."
|
||||||
for i in 0 1 2 3 4 5; do
|
for i in 0 1 2 3 4 5; do
|
||||||
$LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $R1SLAVEPORT \
|
$LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $R1SLAVEPORT \
|
||||||
'objectclass=*' > /dev/null 2>&1
|
'objectclass=*' > /dev/null 2>&1
|
||||||
@ -111,9 +105,13 @@ for i in 0 1 2 3 4 5; do
|
|||||||
sleep 5
|
sleep 5
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "Waiting for the R1 slave to replicate..."
|
if test $RC != 0 ; then
|
||||||
sleep 10
|
echo "ldapsearch failed ($RC)!"
|
||||||
|
kill -HUP $PID $R1SLAVEPID
|
||||||
|
exit $RC
|
||||||
|
fi
|
||||||
|
|
||||||
|
BACKEND=$SAVE
|
||||||
echo "Starting R2 slave slapd on TCP/IP port $R2SLAVEPORT..."
|
echo "Starting R2 slave slapd on TCP/IP port $R2SLAVEPORT..."
|
||||||
. $CONFFILTER $BACKEND $MONITORDB < $R2SRSLAVECONF > $R2REPLCONF
|
. $CONFFILTER $BACKEND $MONITORDB < $R2SRSLAVECONF > $R2REPLCONF
|
||||||
$SLAPD -f $R2REPLCONF -h $R2SLAVEURI -d $LVL $TIMING > $R2SLAVELOG 2>&1 &
|
$SLAPD -f $R2REPLCONF -h $R2SLAVEURI -d $LVL $TIMING > $R2SLAVELOG 2>&1 &
|
||||||
@ -123,7 +121,7 @@ if test $WAIT != 0 ; then
|
|||||||
read foo
|
read foo
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Using ldapsearch to check that the R2 slave slapd is running..."
|
echo "Using ldapsearch to check that the R2 slave slapd PID $R2SLAVEPID is running..."
|
||||||
for i in 0 1 2 3 4 5; do
|
for i in 0 1 2 3 4 5; do
|
||||||
$LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $R2SLAVEPORT \
|
$LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $R2SLAVEPORT \
|
||||||
'objectclass=*' > /dev/null 2>&1
|
'objectclass=*' > /dev/null 2>&1
|
||||||
@ -135,17 +133,13 @@ for i in 0 1 2 3 4 5; do
|
|||||||
sleep 5
|
sleep 5
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "Waiting for the R2 slave to replicate..."
|
if test $RC != 0 ; then
|
||||||
sleep 10
|
echo "ldapsearch failed ($RC)!"
|
||||||
|
kill -HUP $PID $R1SLAVEPID $R2SLAVEPID
|
||||||
|
exit $RC
|
||||||
|
fi
|
||||||
|
|
||||||
SAVE=$BACKEND
|
|
||||||
if test $BACKEND = ldbm; then
|
|
||||||
if test $SYNCREPL = no; then
|
|
||||||
echo "Sync replication requires back-bdb or back-hdb"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
BACKEND=$SYNCREPL
|
BACKEND=$SYNCREPL
|
||||||
fi
|
|
||||||
echo "Starting P1 slave slapd on TCP/IP port $P1SLAVEPORT..."
|
echo "Starting P1 slave slapd on TCP/IP port $P1SLAVEPORT..."
|
||||||
. $CONFFILTER $BACKEND $MONITORDB < $P1SRSLAVECONF > $P1REPLCONF
|
. $CONFFILTER $BACKEND $MONITORDB < $P1SRSLAVECONF > $P1REPLCONF
|
||||||
$SLAPD -f $P1REPLCONF -h $P1SLAVEURI -d $LVL $TIMING > $P1SLAVELOG 2>&1 &
|
$SLAPD -f $P1REPLCONF -h $P1SLAVEURI -d $LVL $TIMING > $P1SLAVELOG 2>&1 &
|
||||||
@ -154,9 +148,8 @@ if test $WAIT != 0 ; then
|
|||||||
echo SLAVE P1 PID $P1SLAVEPID
|
echo SLAVE P1 PID $P1SLAVEPID
|
||||||
read foo
|
read foo
|
||||||
fi
|
fi
|
||||||
BACKEND=$SAVE
|
|
||||||
|
|
||||||
echo "Using ldapsearch to check that the P1 slave slapd is running..."
|
echo "Using ldapsearch to check that the P1 slave slapd PID $P1SLAVEPID is running..."
|
||||||
for i in 0 1 2 3 4 5; do
|
for i in 0 1 2 3 4 5; do
|
||||||
$LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $P1SLAVEPORT \
|
$LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $P1SLAVEPORT \
|
||||||
'objectclass=*' > /dev/null 2>&1
|
'objectclass=*' > /dev/null 2>&1
|
||||||
@ -168,9 +161,13 @@ for i in 0 1 2 3 4 5; do
|
|||||||
sleep 5
|
sleep 5
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "Waiting for the P1 slave to replicate..."
|
if test $RC != 0 ; then
|
||||||
sleep 10
|
echo "ldapsearch failed ($RC)!"
|
||||||
|
kill -HUP $PID $R1SLAVEPID $R2SLAVEPID $P1SLAVEPID
|
||||||
|
exit $RC
|
||||||
|
fi
|
||||||
|
|
||||||
|
BACKEND=$SAVE
|
||||||
echo "Starting P2 slave slapd on TCP/IP port $P2SLAVEPORT..."
|
echo "Starting P2 slave slapd on TCP/IP port $P2SLAVEPORT..."
|
||||||
. $CONFFILTER $BACKEND $MONITORDB < $P2SRSLAVECONF > $P2REPLCONF
|
. $CONFFILTER $BACKEND $MONITORDB < $P2SRSLAVECONF > $P2REPLCONF
|
||||||
$SLAPD -f $P2REPLCONF -h $P2SLAVEURI -d $LVL $TIMING > $P2SLAVELOG 2>&1 &
|
$SLAPD -f $P2REPLCONF -h $P2SLAVEURI -d $LVL $TIMING > $P2SLAVELOG 2>&1 &
|
||||||
@ -180,7 +177,7 @@ if test $WAIT != 0 ; then
|
|||||||
read foo
|
read foo
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Using ldapsearch to check that the P2 slave slapd is running..."
|
echo "Using ldapsearch to check that the P2 slave slapd PID $P2SLAVEPID is running..."
|
||||||
for i in 0 1 2 3 4 5; do
|
for i in 0 1 2 3 4 5; do
|
||||||
$LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $P2SLAVEPORT \
|
$LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $P2SLAVEPORT \
|
||||||
'objectclass=*' > /dev/null 2>&1
|
'objectclass=*' > /dev/null 2>&1
|
||||||
@ -192,6 +189,12 @@ for i in 0 1 2 3 4 5; do
|
|||||||
sleep 5
|
sleep 5
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if test $RC != 0 ; then
|
||||||
|
echo "ldapsearch failed ($RC)!"
|
||||||
|
kill -HUP $PID $R1SLAVEPID $R2SLAVEPID $P1SLAVEPID $P2SLAVEPID
|
||||||
|
exit $RC
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Starting P3 slave slapd on TCP/IP port $P3SLAVEPORT..."
|
echo "Starting P3 slave slapd on TCP/IP port $P3SLAVEPORT..."
|
||||||
. $CONFFILTER $BACKEND $MONITORDB < $P3SRSLAVECONF > $P3REPLCONF
|
. $CONFFILTER $BACKEND $MONITORDB < $P3SRSLAVECONF > $P3REPLCONF
|
||||||
$SLAPD -f $P3REPLCONF -h $P3SLAVEURI -d $LVL $TIMING > $P3SLAVELOG 2>&1 &
|
$SLAPD -f $P3REPLCONF -h $P3SLAVEURI -d $LVL $TIMING > $P3SLAVELOG 2>&1 &
|
||||||
@ -201,7 +204,7 @@ if test $WAIT != 0 ; then
|
|||||||
read foo
|
read foo
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Using ldapsearch to check that the P3 slave slapd is running..."
|
echo "Using ldapsearch to check that the P3 slave slapd PID $P3SLAVEPID is running..."
|
||||||
for i in 0 1 2 3 4 5; do
|
for i in 0 1 2 3 4 5; do
|
||||||
$LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $P3SLAVEPORT \
|
$LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $P3SLAVEPORT \
|
||||||
'objectclass=*' > /dev/null 2>&1
|
'objectclass=*' > /dev/null 2>&1
|
||||||
@ -213,6 +216,12 @@ for i in 0 1 2 3 4 5; do
|
|||||||
sleep 5
|
sleep 5
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if test $RC != 0 ; then
|
||||||
|
echo "ldapsearch failed ($RC)!"
|
||||||
|
kill -HUP $PID $R1SLAVEPID $R2SLAVEPID $P1SLAVEPID $P2SLAVEPID $P3SLAVEPID
|
||||||
|
exit $RC
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Using ldapadd to populate the master directory..."
|
echo "Using ldapadd to populate the master directory..."
|
||||||
$LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT -w $PASSWD < \
|
$LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT -w $PASSWD < \
|
||||||
$LDIFORDEREDNOCP > /dev/null 2>&1
|
$LDIFORDEREDNOCP > /dev/null 2>&1
|
||||||
|
Loading…
Reference in New Issue
Block a user