[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: OpenLdap on Ensim, Plesk, Cpane



tor, 2003-02-06 kl. 20:56 skrev LDAP:

> I am trying to help my web host set up OpenLdap on our server and we are
> having a bit of trouble figuring it out.

Reckon on weeks or months, rather than days.

> The red hat rpm openldap-2.0.21-1 has been istalled.

People will tell you that 2.0.21 is obsolete and that you should at
least have 2.0.27. I run 2.1.12.

> We are also having
> trouble figuring out which program is supposed to start it.  Usually
> Redhat services are started from a service script in /etc/rc.d/init.d -
> but I don't find any references to that for OpenLDAP.

My RH /etc/rc.d/init.d/ldap script follows. However, there are things in
it that will not work for you. As I said, reckon on weeks, rather than
days learning.

Best,

Tony



-- 

Tony Earnshaw

When all's said and done ...
there's nothing left to say or do.

e-post:		tonni@billy.demon.nl
www:		http://www.billy.demon.nl


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

TESTCONFIG="-f /usr/local/ldaptest/etc/openldap/slapd.conf"
DB_BKUPDIR="/usr/local/var/openldap.bkup" ; export DB_BKUPDIR
# Source function library.
. /etc/init.d/functions

# Source networking configuration and check that networking is up.
if [ -r /etc/sysconfig/network ] ; then
	. /etc/sysconfig/network
	[ ${NETWORKING} = "no" ] && exit 0
fi

# Source an auxiliary options file if we have one, and pick up OPTIONS,
# SLAPD_OPTIONS, and SLURPD_OPTIONS.
if [ -r /etc/sysconfig/ldap ] ; then
	. /etc/sysconfig/ldap
fi

slapd=/usr/local/libexec/slapd
testslapd=/usr/local/ldaptest/libexec/slapd
slurpd=/usr/local/libexec/slurpd
[ -x ${slapd} ] || exit 0
[ -x ${slurpd} ] || exit 0

RETVAL=0

function start() {
        # Start daemons.
	prog=`basename ${slapd}`
        echo -n $"Starting $prog: "
	if grep -q ^TLS /usr/local/etc/openldap/slapd.conf ; then
	    #daemon ${slapd} -u ldap -h '"ldap:/// ldaps:///"' $OPTIONS $SLAPD_OPTIONS
	    #daemon ${slapd} -u ldap -h '"ldap:/// ldaps:///"' -s debug $OPTIONS $SLAPD_OPTIONS
	    daemon ${slapd} -u ldap -h '"ldap:/// ldaps:///"' $OPTIONS $SLAPD_OPTIONS
            if [ -x ${testslapd} ]; then
	      daemon ${testslapd} $TESTCONFIG -u ldap -h ldap://127.0.0.1:9009
            fi
	    #daemon ${slapd} -u ldap -s debug $OPTIONS $SLAPD_OPTIONS
	    #/usr/sbin/nscd
	    RETVAL=$?
	else
	    #daemon ${slapd} -u ldap -s debug $OPTIONS $SLAPD_OPTIONS
	    daemon ${slapd} -u ldap $OPTIONS $SLAPD_OPTIONS
	    #/usr/sbin/nscd
	    RETVAL=$?
	fi
	echo
	if [ $RETVAL -eq 0 ]; then
            if grep -q "^replogfile" /usr/local/etc/openldap/slapd.conf; then
		prog=`basename ${slurpd}`
		echo -n $"Starting $prog: "
                daemon ${slurpd} $OPTIONS $SLURPD_OPTIONS
		RETVAL=$?
		echo
            fi
	fi
	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/ldap
	return $RETVAL
}

function stop() {
        # Stop daemons.
	prog=`basename ${slapd}`
	echo -n $"Stopping $prog: "
	killproc ${slapd}
        if [ -x ${testslapd} ]; then
          killproc ${testslapd}
        fi
	if [ "`ps -ef|grep nscd`" ]; then
		/usr/bin/killall nscd > /dev/null 2>&1
	fi
	RETVAL=$?
	echo
	if [ $RETVAL -eq 0 ]; then
	    if grep -q "^replogfile" /usr/local/etc/openldap/slapd.conf; then
		prog=`basename ${slurpd}`
		echo -n $"Stopping $prog: "
		killproc ${slurpd}
		RETVAL=$?
		echo
	    fi
	fi
        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/ldap /usr/local/var/slapd.args
	return $RETVAL
}

# See how we were called.
case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    status)
        status ${slapd}
        if grep -q "^replogfile" /usr/local/etc/openldap/slapd.conf ; then
            status ${slurpd}
	fi
	;;
    restart)
	stop
	start
	;;
    reload)
    	killproc ${slapd} -HUP
	RETVAL=$?
	if [ $RETVAL -eq 0 ]; then
	    if grep -q "^replogfile" /usr/local/etc/openldap/slapd.conf; then
		killproc ${slurpd} -HUP
		RETVAL=$?
	    fi
	fi
	;;
    condrestart)
        if [ -f /usr/local/var/ldap ] ; then
            stop
            start
        fi
	;;
    *)
	echo $"Usage: $0 {start|stop|restart|status|condrestart}"
	RETVAL=1
esac

exit $RETVAL