67 lines
1.6 KiB
Plaintext
67 lines
1.6 KiB
Plaintext
|
#!/sbin/runscript
|
||
|
# Copyright 1999-2005 Gentoo Foundation
|
||
|
# Distributed under the terms of the GNU General Public License v2
|
||
|
# $Header: /var/cvsroot/gentoo/src/patchsets/glibc/extra/etc/nscd,v 1.8 2012/12/16 22:28:41 vapier Exp $
|
||
|
|
||
|
depend() {
|
||
|
use dns ldap net slapd
|
||
|
}
|
||
|
|
||
|
checkconfig() {
|
||
|
if [ ! -d /var/run/nscd ] ; then
|
||
|
checkpath -d -m 755 /var/run/nscd
|
||
|
fi
|
||
|
if [ -z "${NSCD_PERMS_OK}" ] && [ "$(stat -c %a /var/run/nscd)" != "755" ] ; then
|
||
|
ewarn "nscd run dir is not world readable, you should reset the perms:"
|
||
|
ewarn "chmod 755 /var/run/nscd"
|
||
|
ewarn "chmod a+rw /var/run/nscd/socket"
|
||
|
ewarn "To disable this warning, set 'NSCD_PERMS_OK' in /etc/conf.d/nscd"
|
||
|
fi
|
||
|
|
||
|
if grep -qs '^[[:space:]]*persistent\>' /etc/nscd.conf ; then
|
||
|
checkpath -d -m 700 /var/db/nscd
|
||
|
fi
|
||
|
}
|
||
|
|
||
|
start() {
|
||
|
checkconfig
|
||
|
|
||
|
ebegin "Starting Name Service Cache Daemon"
|
||
|
|
||
|
local secure=`while read curline ; do
|
||
|
table=${curline%:*}
|
||
|
entries=${curline##$table:}
|
||
|
table=${table%%[!a-z]*}
|
||
|
case $table in
|
||
|
passwd*|group*|hosts)
|
||
|
for entry in $entries ; do
|
||
|
case $entry in
|
||
|
nisplus*)
|
||
|
nscd_nischeck $table || \
|
||
|
echo "-S $table,yes"
|
||
|
;;
|
||
|
esac
|
||
|
done
|
||
|
;;
|
||
|
esac
|
||
|
done < /etc/nsswitch.conf`
|
||
|
|
||
|
local pidfile="/var/run/nscd/nscd.pid"
|
||
|
mkdir -p "${pidfile%/*}"
|
||
|
|
||
|
start-stop-daemon --start --quiet --background \
|
||
|
--exec /usr/sbin/nscd --pidfile ${pidfile} \
|
||
|
-- --foreground $secure
|
||
|
eend $?
|
||
|
}
|
||
|
|
||
|
stop() {
|
||
|
local pidfile="/var/run/nscd/nscd.pid"
|
||
|
ebegin "Shutting down Name Service Cache Daemon"
|
||
|
start-stop-daemon --stop --quiet \
|
||
|
--exec /usr/sbin/nscd --pidfile ${pidfile}
|
||
|
eend $?
|
||
|
}
|
||
|
|
||
|
# vim:ts=4
|