#!/sbin/runscript
# Copyright 1999-2002 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /home/cvsroot/gentoo-src/rc-scripts/init.d/nscd,v 1.6 2002/11/18 13:07:02 azarah Exp $


start() {
	ebegin "Starting Name Service Cache Daemon"
	secure=` cat /etc/nsswitch.conf | 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*)
					/usr/sbin/nscd_nischeck $table || \
					/echo "-S $table,yes"
				;;
			esac
			done
		;;
		esac
		done`
	start-stop-daemon --start --quiet --exec /usr/sbin/nscd -- $secure
	eend $?
}

stop () {
	ebegin "Shutting down Name Service Cache Daemon"
	start-stop-daemon --stop --quiet --pid /var/run/nscd.pid
	eend $?
}


# vim:ts=4
