]> git.sur5r.net Git - openldap/blob - tests/scripts/startup_nis_ldap_server.sh
Happy New Year
[openldap] / tests / scripts / startup_nis_ldap_server.sh
1 #! /bin/sh
2 # $OpenLDAP$
3 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
4 ##
5 ## Copyright 1998-2018 The OpenLDAP Foundation.
6 ## All rights reserved.
7 ##
8 ## Redistribution and use in source and binary forms, with or without
9 ## modification, are permitted only as authorized by the OpenLDAP
10 ## Public License.
11 ##
12 ## A copy of this license is available in the file LICENSE in the
13 ## top-level directory of the distribution or, alternatively, at
14 ## <http://www.OpenLDAP.org/license.html>.
15
16 if [ $# -eq 0 ]; then
17         SRCDIR="."
18 else
19         SRCDIR=$1; shift
20 fi
21 if [ $# -eq 1 ]; then
22         BDB2=$1; shift
23 fi
24
25 . $SRCDIR/scripts/defines.sh $SRCDIR $BDB2
26
27 # Sample NIS database in LDIF format
28 NIS_LDIF=$SRCDIR/data/nis_sample.ldif
29
30 # Sample configuration file for your LDAP server
31 if test "$BACKEND" = "bdb2" ; then
32         NIS_CONF=$DATADIR/slapd-bdb2-nis-master.conf
33 else
34         NIS_CONF=$DATADIR/slapd-nis-master.conf
35 fi
36
37 echo "Cleaning up in $DBDIR..."
38
39 rm -f $DBDIR/[!C]*
40
41 echo "Running slapadd to build slapd database..."
42 $SLAPADD -f $NIS_CONF -l $NIS_LDIF
43 RC=$?
44 if [ $RC != 0 ]; then
45         echo "slapadd failed!"
46         exit $RC
47 fi
48
49 echo "Starting slapd on TCP/IP port $PORT..."
50 $SLAPD -f $NIS_CONF -p $PORT -d $LVL $TIMING > $MASTERLOG 2>&1 &
51 PID=$!
52
53 echo ">>>>> LDAP server with NIS schema is up! PID=$PID"
54
55
56 exit 0