openldap/tests/scripts/startup_nis_ldap_server.sh

57 lines
1.3 KiB
Bash
Raw Normal View History

1999-09-02 08:52:43 +08:00
#! /bin/sh
# $OpenLDAP$
2003-11-29 04:00:23 +08:00
## This work is part of OpenLDAP Software <http://www.openldap.org/>.
##
2005-01-02 04:49:32 +08:00
## Copyright 1998-2005 The OpenLDAP Foundation.
2003-11-29 04:00:23 +08:00
## All rights reserved.
##
## Redistribution and use in source and binary forms, with or without
## modification, are permitted only as authorized by the OpenLDAP
## Public License.
##
## A copy of this license is available in the file LICENSE in the
## top-level directory of the distribution or, alternatively, at
## <http://www.OpenLDAP.org/license.html>.
1999-05-27 03:18:05 +08:00
if [ $# -eq 0 ]; then
SRCDIR="."
else
SRCDIR=$1; shift
fi
if [ $# -eq 1 ]; then
BDB2=$1; shift
fi
. $SRCDIR/scripts/defines.sh $SRCDIR $BDB2
# Sample NIS database in LDIF format
1999-05-27 07:52:27 +08:00
NIS_LDIF=$SRCDIR/data/nis_sample.ldif
1999-05-27 03:18:05 +08:00
# Sample configuration file for your LDAP server
if test "$BACKEND" = "bdb2" ; then
NIS_CONF=$DATADIR/slapd-bdb2-nis-master.conf
else
NIS_CONF=$DATADIR/slapd-nis-master.conf
fi
echo "Cleaning up in $DBDIR..."
rm -f $DBDIR/[!C]*
1999-08-23 01:10:23 +08:00
echo "Running slapadd to build slapd database..."
2000-07-27 02:13:38 +08:00
$SLAPADD -f $NIS_CONF -l $NIS_LDIF
1999-05-27 03:18:05 +08:00
RC=$?
if [ $RC != 0 ]; then
1999-08-23 01:10:23 +08:00
echo "slapadd failed!"
1999-05-27 03:18:05 +08:00
exit $RC
fi
echo "Starting slapd on TCP/IP port $PORT..."
$SLAPD -f $NIS_CONF -p $PORT -d $LVL $TIMING > $MASTERLOG 2>&1 &
PID=$!
echo ">>>>> LDAP server with NIS schema is up! PID=$PID"
exit 0