#!/bin/sh
#
# chkconfig: - 91 35
# description: Starts and stops the OpenLDAP slapd daemon
#
# pidfile: /usr/local/openldap-2.2.4/var/run/slapd.pid
# config: /usr/local/openldap-2.2.4/etc/openldap/slapd.conf
INSTALL_BASE=/usr/local/openldap-2.2.4
BDB_BASE=/usr/local/BerkeleyDB.4.2
# Source function library.
if [ -f /etc/init.d/functions ] ; then
. /etc/init.d/functions
elif [ -f /etc/rc.d/init.d/functions ] ; then
. /etc/rc.d/init.d/functions
else
exit 0
fi
# Avoid using root's TMPDIR
unset TMPDIR
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
# Check that smb.conf exists.
[ -f $INSTALL_BASE/etc/openldap/slapd.conf ] || exit 0
RETVAL=0
start() {
action "Recovering slapd database: " $BDB_BASE/bin/db_recover -h $INSTALL_BASE/var/openldap-data
action "Recovering slapd database (US): " $BDB_BASE/bin/db_recover -h $INSTALL_BASE/var/openldap-us-data
echo -n $"Starting slapd: "
daemon $INSTALL_BASE/libexec/slapd
RETVAL=$?
echo
return $RETVAL
}
stop() {
KIND="SMB"
echo -n $"Shutting down slapd: "
action "" kill -INT `cat $INSTALL_BASE/var/run/slapd.pid`
RETVAL=$?
echo
return $RETVAL
}
restart() {
stop
start
}
reload() {
echo -n $"Reloading slapd.conf file: "
killproc slapd -HUP
RETVAL=$?
echo
return $RETVAL
}
rhstatus() {
status slapd
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
reload)
reload
;;
status)
rhstatus
;;
*)
echo $"Usage: $0 {start|stop|restart|status}"
exit 1
esac
exit $?