1158115Sume#!/bin/sh 2158115Sume# 3158115Sume# $FreeBSD: releng/10.2/etc/rc.d/nscd 230099 2012-01-14 02:18:41Z dougb $ 4158115Sume# 5158115Sume 6171795Sbushman# PROVIDE: nscd 7158115Sume# REQUIRE: DAEMON 8158115Sume# BEFORE: LOGIN 9180564Sdougb# KEYWORD: shutdown 10158115Sume 11158115Sume# 12172377Sbushman# Add the following lines to /etc/rc.conf to enable nscd: 13158115Sume# 14171795Sbushman# nscd_enable="YES" 15158115Sume# 16171795Sbushman# See nscd(8) for flags 17158115Sume# 18158115Sume 19158115Sume. /etc/rc.subr 20158115Sume 21193119Sdougbname="nscd" 22230099Sdougbrcvar="nscd_enable" 23158115Sume 24171795Sbushmancommand=/usr/sbin/nscd 25159348Sumeextra_commands="flush" 26159348Sumeflush_cmd="${command} -I all" 27158115Sume 28172377Sbushman# usage: _nscd_set_option <option name> <default value> 29172377Sbushman# 30172377Sbushman_nscd_set_option() { 31172377Sbushman local _optname _defoptval _nscd_opt_val _cached_opt_val 32172377Sbushman _optname=$1 33172377Sbushman _defoptval=$2 34158115Sume 35172377Sbushman _nscd_opt_val=$(eval "echo \$nscd_${_optname}") 36172377Sbushman _cached_opt_val=$(eval "echo \$cached_${_optname}") 37208060Sdougb 38172377Sbushman if [ -n "$_cached_opt_val" -a "$_nscd_opt_val" != "$_defoptval" ]; then 39172377Sbushman warn "You should use nscd_${_optname} instead of" \ 40172377Sbushman "cached_${_optname}" 41172377Sbushman setvar "nscd_${_optname}" "$_cached_opt_val" 42172377Sbushman else 43172377Sbushman setvar "nscd_${_optname}" "${_nscd_opt_val:-$_defoptval}" 44172377Sbushman fi 45172377Sbushman} 46172377Sbushman 47172377Sbushman 48158115Sumeload_rc_config $name 49172377Sbushman_nscd_set_option "enable" "NO" 50172377Sbushman_nscd_set_option "pidfile" "/var/run/nscd.pid" 51172377Sbushman_nscd_set_option "flags" "" 52158115Sumerun_rc_command "$1" 53172377Sbushman 54