1#!/bin/sh 2# 3# $FreeBSD: releng/10.2/etc/rc.d/nscd 230099 2012-01-14 02:18:41Z dougb $ 4# 5 6# PROVIDE: nscd 7# REQUIRE: DAEMON 8# BEFORE: LOGIN 9# KEYWORD: shutdown 10 11# 12# Add the following lines to /etc/rc.conf to enable nscd: 13# 14# nscd_enable="YES" 15# 16# See nscd(8) for flags 17# 18 19. /etc/rc.subr 20 21name="nscd" 22rcvar="nscd_enable" 23 24command=/usr/sbin/nscd 25extra_commands="flush" 26flush_cmd="${command} -I all" 27 28# usage: _nscd_set_option <option name> <default value> 29# 30_nscd_set_option() { 31 local _optname _defoptval _nscd_opt_val _cached_opt_val 32 _optname=$1 33 _defoptval=$2 34 35 _nscd_opt_val=$(eval "echo \$nscd_${_optname}") 36 _cached_opt_val=$(eval "echo \$cached_${_optname}") 37 38 if [ -n "$_cached_opt_val" -a "$_nscd_opt_val" != "$_defoptval" ]; then 39 warn "You should use nscd_${_optname} instead of" \ 40 "cached_${_optname}" 41 setvar "nscd_${_optname}" "$_cached_opt_val" 42 else 43 setvar "nscd_${_optname}" "${_nscd_opt_val:-$_defoptval}" 44 fi 45} 46 47 48load_rc_config $name 49_nscd_set_option "enable" "NO" 50_nscd_set_option "pidfile" "/var/run/nscd.pid" 51_nscd_set_option "flags" "" 52run_rc_command "$1" 53 54