File rc.nslcd of Package nss-ldapd

#! /bin/sh
# Copyright (c) 2007 SUSE Linux Products GmbH, Nuernberg, Germany.
# All rights reserved.
#
# Author: Ralf Haferkamp <rhafer@suse.de>
#
# /etc/init.d/nslcd
#   and its symbolic link
# /usr/sbin/rcnslcd
#
### BEGIN INIT INFO
# Provides:       nslcd
# Required-Start: $network $syslog $remote_fs
# Required-Stop: $network $syslog $remote_fs
# Default-Start:  3 5
# Default-Stop:   0 1 2 6
# Short-Description: NSS LDAP client daemon
# Description:       nslcd is a LDAP connection daemon that is
#	used to do LDAP queries for the NSS LDAP module.
### END INIT INFO

NSLCD_BIN="/usr/sbin/nslcd"
test -x $NSLCD_BIN || exit 5

# Shell functions sourced from /etc/rc.status:
#      rc_check         check and set local and overall rc status
#      rc_status        check and set local and overall rc status
#      rc_status -v     ditto but be verbose in local rc status
#      rc_status -v -r  ditto and clear the local rc status
#      rc_failed        set local and overall rc status to failed
#      rc_failed <num>  set local and overall rc status to <num><num>
#      rc_reset         clear local rc status (overall remains)
#      rc_exit          exit appropriate to overall rc status
. /etc/rc.status

# First reset status of this service
rc_reset

case "$1" in
    start)
        echo -n "Starting NSS LDAP Client Daemon"
        /sbin/startproc -p /var/run/nslcd/nslcd.pid $NSLCD_BIN
        rc_status -v
        ;;
    stop)
        echo -n "Shutting down NSS LDAP Client Daemon"
        /sbin/killproc -p /var/run/nslcd/nslcd.pid $NSLCD_BIN
        rc_status -v
        ;;
    try-restart)
        ## Stop the service and if this succeeds (i.e. the 
        ## service was running before), start it again.
        ## Note: try-restart is not (yet) part of LSB (as of 0.7.5)
        $0 status >/dev/null &&  $0 restart

        # Remember status and be quiet
        rc_status
        ;;
    restart)
        ## Stop the service and regardless of whether it was
        ## running or not, start it again.
        $0 stop
        $0 start
        # Remember status and be quiet
        rc_status
        ;;
    force-reload)
        $0 stop; sleep 3;  $0 start
        rc_status
        ;;
    reload)
        echo -n "Reload ldap server"

        ## Otherwise if it does not support reload:
        rc_failed 3
        rc_status -v
        ;;
    status)
        echo -n "Checking for NSS LDAP Client Daemon: " 
        checkproc -p /var/run/nslcd/nslcd.pid $NSLCD_BIN
        rc_status -v
        ;;
    *)
        echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}"
        exit 1
esac
rc_exit
openSUSE Build Service is sponsored by