Sophie

Sophie

distrib > Mandriva > 8.2 > i586 > media > contrib > by-pkgid > 0041cd0800322e377304cdac468347ab > files > 6

openldap1-1.2.12-1mdk.i586.rpm

#!/bin/sh
#
# ldap	This shell script takes care of starting and stopping
#	ldap servers (slapd and slurpd).
#
# chkconfig: - 70 40
# description: LDAP stands for Lightweight Directory Access Protocol, used \
#              for implementing the industry standard directory services.
# processname: slapd
# config: /etc/openldap/slapd.conf
# pidfile: /var/run/slapd.pid

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

[ -f /usr/sbin/slapd ] || exit 0
[ -f /usr/sbin/slurpd ] || exit 0

RETVAL=0

# See how we were called.
case "$1" in
    start)
        # Start daemons.
        echo -n "Starting ldap: "
        daemon slapd
	RETVAL=$?
	if [ $RETVAL -eq 0 ]; then
            if grep -q "^replogfile" /etc/openldap/slapd.conf; then
		daemon slurpd
		RETVAL=$?
		[ $RETVAL -eq 0 ] && pidof slurpd | cut -f 1 -d " " > /var/run/slurpd
            fi
	fi
        echo
	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/ldap
        ;;
    stop)
        # Stop daemons.
	echo -n "Shutting down ldap: "
	killproc slapd
	RETVAL=$?
	if [ $RETVAL -eq 0 ]; then
	    if grep -q "^replogfile" /etc/openldap/slapd.conf; then
		killproc slurpd
		RETVAL=$?
	    fi
	fi
	echo
        if [ $RETVAL -eq 0 ]; then
	    rm -f /var/lock/subsys/ldap
	    rm -f /var/run/slapd.args
	fi
        ;;
    status)
	status slapd
	RETVAL=$?
	if [ $RETVAL -eq 0 ]; then
	    if grep -q "^replogfile" /etc/openldap/slapd.conf; then
		status slurpd
		RETVAL=$?
	    fi
	fi
	;;
    restart)
	$0 stop
	$0 start
	RETVAL=$?
	;;
    reload)
    	killproc -HUP slapd
	RETVAL=$?
	if [ $RETVAL -eq 0 ]; then
	    if grep -q "^replogfile" /etc/openldap/slapd.conf; then
		killproc -HUP slurpd
		RETVAL=$?
	    fi
	fi
	;;
    *)
	echo "Usage: $0 start|stop|restart|status}"
	exit 1
esac

exit $RETVAL