#!/bin/sh # # nslcd: Starts the Name Switch Cache Daemon # # chkconfig: - 30 74 # description: This is a daemon which handles passwd and group lookups \ # for running programs and cache the results for the next \ # query. You should start this daemon if you use \ # slow naming services like NIS, NIS+, LDAP, or hesiod. # processname: /usr/sbin/nslcd # config: /etc/nslcd.conf # pidfile: /var/run/nslcd/nslcd.pid # WITHOUT_RC_COMPAT=1 # Source function library. . /etc/init.d/functions CONFIG=/etc/nslcd.conf PIDFILE=/var/run/nslcd/nslcd.pid LOCKFILE=/var/lock/subsys/nslcd RETVAL=0 OPTIONS= SourceIfNotEmpty /etc/sysconfig/nslcd start() { [ -s "$CONFIG" ] || return 0 start_daemon --pidfile "$PIDFILE" --lockfile "$LOCKFILE" --expect-user _nslcd -- nslcd $OPTIONS RETVAL=$? return $RETVAL } stop() { stop_daemon --pidfile "$PIDFILE" --lockfile "$LOCKFILE" --expect-user _nslcd -- nslcd RETVAL=$? if [ $RETVAL -eq 0 ]; then # nslcd won't be able to remove these when it is running # as a non-privileged user rm -f /var/run/nslcd/socket fi return $RETVAL } reload() { msg_reloading nslcd stop_daemon --pidfile "$PIDFILE" --expect-user _nslcd -HUP -- nslcd RETVAL=$? return $RETVAL } restart() { stop start } # See how we were called. case "$1" in start) start ;; stop) stop ;; reload) reload ;; restart) restart ;; condstop) if [ -e "$LOCKFILE" ]; then stop fi ;; condrestart) if [ -e "$LOCKFILE" ]; then restart fi ;; condreload) if [ -e "$LOCKFILE" ]; then reload fi ;; status) status --pidfile "$PIDFILE" --expect-user _nslcd -- nslcd RETVAL=$? ;; *) msg_usage "${0##*/} {start|stop|status|restart|reload|condstop|condrestart|condreload}" RETVAL=1 ;; esac exit $RETVAL