Blame | Last modification | View Log | RSS feed
#!/bin/bash## 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# config: /etc/sysconfig/nscd#### BEGIN INIT INFO# Provides: nscd# Required-Start: $syslog# Default-Stop: 0 1 6# Short-Description: Starts the Name Switch Cache Daemon# 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.### END INIT INFO# Sanity checks.[ -f /etc/nscd.conf ] || exit 0[ -x /usr/sbin/nscd ] || exit 0# Source function library.. /etc/init.d/functions# Source an auxiliary options file if we have one, and pick up NSCD_OPTIONS.[ -r /etc/sysconfig/nscd ] && . /etc/sysconfig/nscdRETVAL=0prog=nscdstart () {[ -d /var/run/nscd ] || mkdir /var/run/nscd[ -d /var/db/nscd ] || mkdir /var/db/nscdecho -n $"Starting $prog: "daemon /usr/sbin/nscd $NSCD_OPTIONSRETVAL=$?echo[ $RETVAL -eq 0 ] && touch /var/lock/subsys/nscdreturn $RETVAL}stop () {echo -n $"Stopping $prog: "/usr/sbin/nscd -KRETVAL=$?if [ $RETVAL -eq 0 ]; thenrm -f /var/lock/subsys/nscd# nscd won't be able to remove these if it is running as# a non-privileged userrm -f /var/run/nscd/nscd.pidrm -f /var/run/nscd/socketsuccess $"$prog shutdown"elsefailure $"$prog shutdown"fiechoreturn $RETVAL}restart() {stopstart}# See how we were called.case "$1" instart)[ -e /var/lock/subsys/nscd ] || startRETVAL=$?;;stop)[ ! -e /var/lock/subsys/nscd ] || stopRETVAL=$?;;status)status nscdRETVAL=$?;;restart)restartRETVAL=$?;;try-restart | condrestart)[ ! -e /var/lock/subsys/nscd ] || restartRETVAL=$?;;force-reload | reload)echo -n $"Reloading $prog: "RETVAL=0/usr/sbin/nscd -i passwd || RETVAL=$?/usr/sbin/nscd -i group || RETVAL=$?/usr/sbin/nscd -i hosts || RETVAL=$?/usr/sbin/nscd -i services || RETVAL=$?echo;;*)echo $"Usage: $0 {start|stop|status|restart|reload|condrestart}"RETVAL=1;;esacexit $RETVAL