summaryrefslogtreecommitdiff
blob: 7945cc2796ddcc2a4ab71f5101ec61a128702074 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#! /bin/sh
#RCUPDATE:3 4:72

.  /etc/rc.d/config/functions

SERVICE=nscd
EXE=/usr/sbin/nscd
opts="start stop restart"

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 $EXE -- $secure 1>&2
	eend $? "Error starting $SERVICE"
}
stop () {
	ebegin "Shutting down Name Service Cache Daemon"
	start-stop-daemon --stop --quiet --pid /var/run/nscd.pid 1>&2
	eend $? "Error stopping $SERVICE"
}

restart () {
	stop
	start
}

doservice ${@}