#!/bin/sh # # nscd: 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/nscd # config: /etc/nscd.conf # WITHOUT_RC_COMPAT=1 # Source function library. . /etc/init.d/functions CONFIG=/etc/nscd.conf PIDFILE=/var/run/nscd/nscd.pid LOCKFILE=/var/lock/subsys/nscd RETVAL=0 start() { [ -s "$CONFIG" ] || return 0 start_daemon --pidfile "$PIDFILE" --lockfile "$LOCKFILE" --expect-user nscd -- nscd RETVAL=$? return $RETVAL } stop() { stop_daemon --pidfile "$PIDFILE" --lockfile "$LOCKFILE" --expect-user nscd -- nscd RETVAL=$? if [ $RETVAL -eq 0 ]; then # nscd won't be able to remove these when it is running # as a non-privileged user rm -f /var/run/nscd/socket fi return $RETVAL } reload() { msg_reloading nscd stop_daemon --pidfile "$PIDFILE" --expect-user nscd -HUP -- nscd 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 nscd -- nscd RETVAL=$? ;; *) msg_usage "${0##*/} {start|stop|status|restart|reload|condstop|condrestart|condreload}" RETVAL=1 ;; esac exit $RETVAL