Patrick Welche <prlw1@cam.ac.uk>
[netbsd-mini2440.git] / external / bsd / openldap / dist / tests / scripts / startup_nis_ldap_server.sh
blob4fdf1a4af05f5a87ec2c3540fdf216a50ffa8040
1 #! /bin/sh
2 # $OpenLDAP: pkg/ldap/tests/scripts/startup_nis_ldap_server.sh,v 1.14.2.3 2008/02/11 23:26:50 kurt Exp $
3 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
4 ##
5 ## Copyright 1998-2008 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.
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>.
16 if [ $# -eq 0 ]; then
17 SRCDIR="."
18 else
19 SRCDIR=$1; shift
21 if [ $# -eq 1 ]; then
22 BDB2=$1; shift
25 . $SRCDIR/scripts/defines.sh $SRCDIR $BDB2
27 # Sample NIS database in LDIF format
28 NIS_LDIF=$SRCDIR/data/nis_sample.ldif
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
37 echo "Cleaning up in $DBDIR..."
39 rm -f $DBDIR/[!C]*
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
49 echo "Starting slapd on TCP/IP port $PORT..."
50 $SLAPD -f $NIS_CONF -p $PORT -d $LVL $TIMING > $MASTERLOG 2>&1 &
51 PID=$!
53 echo ">>>>> LDAP server with NIS schema is up! PID=$PID"
56 exit 0