case "$1" in
    start)
        echo -n "Starting-up Open LDAP servers:"
        for nom in `echo $ServerNames`
        do
             eval LDAP_ARGS=\$$nom"_args"
             SLAPD_CMD=$SLAPD_BIN" "$LDAP_ARGS
             $SLAPD_CMD & 
             [ $? -eq 0 ] && echo $N "$nom $C"
        done
        ;;
    stop)
        echo -n "Shutting down ALL Open LDAP server: "
        for nom in `echo $ServerNames`
        do
            eval ldap_args=\$$nom"_args"
            LDAP_ARGS=`echo $ldap_args | cut -f1-2  -d"-" 2>/dev/null`
            SLAPD_CMD=$SLAPD_BIN" "$LDAP_ARGS
            pids=`ps -ef | grep "$SLAPD_CMD" | \
                       grep -v grep | awk '{ print $2 }' `
                if [ -n "$pids" ] ; then
                        kill -TERM $pids
                        [ $? -eq 0 ] && echo $N "$nom $C"
                fi
        done
        ;;
    restart)
	$0 stop
	# sometimes slapd needs some time to stop
	sleep 3
	$0 start
        ;;
    *)
	echo "$USAGE"
        exit 1
esac
echo " "
