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