2006-04-28 14:03:38 +02:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# $FreeBSD$
|
|
|
|
#
|
|
|
|
|
2007-08-09 15:06:12 +02:00
|
|
|
# PROVIDE: nscd
|
2006-04-28 14:03:38 +02:00
|
|
|
# REQUIRE: DAEMON
|
|
|
|
# BEFORE: LOGIN
|
2008-07-16 21:50:29 +02:00
|
|
|
# KEYWORD: shutdown
|
2006-04-28 14:03:38 +02:00
|
|
|
|
|
|
|
#
|
2007-09-28 12:38:08 +02:00
|
|
|
# Add the following lines to /etc/rc.conf to enable nscd:
|
2006-04-28 14:03:38 +02:00
|
|
|
#
|
2007-08-09 15:06:12 +02:00
|
|
|
# nscd_enable="YES"
|
2006-04-28 14:03:38 +02:00
|
|
|
#
|
2007-08-09 15:06:12 +02:00
|
|
|
# See nscd(8) for flags
|
2006-04-28 14:03:38 +02:00
|
|
|
#
|
|
|
|
|
|
|
|
. /etc/rc.subr
|
|
|
|
|
2009-05-30 23:51:38 +02:00
|
|
|
name="nscd"
|
2016-04-23 18:10:54 +02:00
|
|
|
desc="Name-service caching daemon"
|
2012-01-14 03:18:41 +01:00
|
|
|
rcvar="nscd_enable"
|
2006-04-28 14:03:38 +02:00
|
|
|
|
2007-08-09 15:06:12 +02:00
|
|
|
command=/usr/sbin/nscd
|
2006-06-06 17:34:50 +02:00
|
|
|
extra_commands="flush"
|
|
|
|
flush_cmd="${command} -I all"
|
2006-04-28 14:03:38 +02:00
|
|
|
|
2007-09-28 12:38:08 +02:00
|
|
|
# usage: _nscd_set_option <option name> <default value>
|
|
|
|
#
|
|
|
|
_nscd_set_option() {
|
|
|
|
local _optname _defoptval _nscd_opt_val _cached_opt_val
|
|
|
|
_optname=$1
|
|
|
|
_defoptval=$2
|
|
|
|
|
|
|
|
_nscd_opt_val=$(eval "echo \$nscd_${_optname}")
|
|
|
|
_cached_opt_val=$(eval "echo \$cached_${_optname}")
|
2010-05-14 06:53:57 +02:00
|
|
|
|
2007-09-28 12:38:08 +02:00
|
|
|
if [ -n "$_cached_opt_val" -a "$_nscd_opt_val" != "$_defoptval" ]; then
|
|
|
|
warn "You should use nscd_${_optname} instead of" \
|
|
|
|
"cached_${_optname}"
|
|
|
|
setvar "nscd_${_optname}" "$_cached_opt_val"
|
|
|
|
else
|
|
|
|
setvar "nscd_${_optname}" "${_nscd_opt_val:-$_defoptval}"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2006-04-28 14:03:38 +02:00
|
|
|
|
|
|
|
load_rc_config $name
|
2007-09-28 12:38:08 +02:00
|
|
|
_nscd_set_option "enable" "NO"
|
|
|
|
_nscd_set_option "pidfile" "/var/run/nscd.pid"
|
|
|
|
_nscd_set_option "flags" ""
|
2006-04-28 14:03:38 +02:00
|
|
|
run_rc_command "$1"
|
2007-09-28 12:38:08 +02:00
|
|
|
|