]> git.sur5r.net Git - openldap/blob - tests/scripts/start-server
second level interval support, interval=dd:hh:mm:ss
[openldap] / tests / scripts / start-server
1 #! /bin/sh
2 # $OpenLDAP$
3
4 echo "running defines.sh"
5 . $SRCDIR/scripts/defines.sh
6
7 mkdir -p $TESTDIR $DBDIR1
8
9 echo "Running slapadd to build slapd database..."
10 . $CONFFILTER $BACKEND < $CONF > $ADDCONF
11 $SLAPADD -f $ADDCONF -l $LDIFORDERED
12 RC=$?
13 if test $RC != 0 ; then
14         echo "slapadd failed ($RC)!"
15         exit $RC
16 fi
17
18 echo "Starting slapd on TCP/IP port $PORT1..."
19 . $CONFFILTER $BACKEND < $CONF > $CONF1
20 $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
21 PID=$!
22
23 echo "Using ldapsearch to retrieve all the entries..."
24 for i in 0 1 2 3 4 5; do
25         $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 > $SEARCHOUT 2>&1
26         RC=$?
27         if test $RC = 1 ; then
28                 echo "Waiting 5 seconds for slapd to start..."
29                 sleep 5
30         fi
31 done
32
33 if test $RC != 0 ; then
34         echo "ldapsearch failed ($RC)!"
35         exit $RC
36 fi
37
38 echo "Filtering ldapsearch results..."
39 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
40 echo "Filtering original ldif used to create database..."
41 . $LDIFFILTER < $LDIF > $LDIFFLT
42 echo "Comparing filter output..."
43 $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
44
45 if test $? != 0 ; then
46         echo "comparison failed - database was not created correctly"
47         exit 1
48 fi
49
50 echo ">>>>> Server1 (pid=$PID) started"
51 exit 0