Updated to fedora-glibc-20060306T0720
[glibc.git] / nscd / nscd.init
blob1fba72f5c32d24073ac04a4131642bc7d81d2b21
1 #!/bin/bash
3 # nscd: Starts the Name Switch Cache Daemon
5 # chkconfig: - 30 74
6 # description: This is a daemon which handles passwd and group lookups \
7 # for running programs and cache the results for the next \
8 # query. You should start this daemon if you use \
9 # slow naming services like NIS, NIS+, LDAP, or hesiod.
10 # processname: /usr/sbin/nscd
11 # config: /etc/nscd.conf
12 # config: /etc/sysconfig/nscd
14 ### BEGIN INIT INFO
15 # Provides: nscd
16 # Required-Start: $syslog
17 # Default-Stop: 0 1 6
18 # Short-Description: Starts the Name Switch Cache Daemon
19 # Description: This is a daemon which handles passwd and group lookups \
20 # for running programs and cache the results for the next \
21 # query. You should start this daemon if you use \
22 # slow naming services like NIS, NIS+, LDAP, or hesiod.
23 ### END INIT INFO
25 # Sanity checks.
26 [ -f /etc/nscd.conf ] || exit 0
27 [ -x /usr/sbin/nscd ] || exit 0
29 # Source function library.
30 . /etc/init.d/functions
32 # Source an auxiliary options file if we have one, and pick up NSCD_OPTIONS.
33 [ -r /etc/sysconfig/nscd ] && . /etc/sysconfig/nscd
35 RETVAL=0
36 prog=nscd
38 start () {
39 [ -d /var/run/nscd ] || mkdir /var/run/nscd
40 [ -d /var/db/nscd ] || mkdir /var/db/nscd
41 secure=""
42 # for table in passwd group hosts
43 # do
44 # if egrep -q '^'$table':.*nisplus' /etc/nsswitch.conf; then
45 # /usr/lib/nscd_nischeck $table || secure="$secure -S $table,yes"
46 # fi
47 # done
48 echo -n $"Starting $prog: "
49 daemon /usr/sbin/nscd $secure $NSCD_OPTIONS
50 RETVAL=$?
51 echo
52 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/nscd
53 return $RETVAL
56 stop () {
57 echo -n $"Stopping $prog: "
58 /usr/sbin/nscd -K
59 RETVAL=$?
60 if [ $RETVAL -eq 0 ]; then
61 rm -f /var/lock/subsys/nscd
62 # nscd won't be able to remove these if it is running as
63 # a non-privileged user
64 rm -f /var/run/nscd/nscd.pid
65 rm -f /var/run/nscd/socket
66 success $"$prog shutdown"
67 else
68 failure $"$prog shutdown"
70 echo
71 return $RETVAL
74 restart() {
75 stop
76 start
79 # See how we were called.
80 case "$1" in
81 start)
82 start
83 RETVAL=$?
85 stop)
86 stop
87 RETVAL=$?
89 status)
90 status nscd
91 RETVAL=$?
93 restart)
94 restart
95 RETVAL=$?
97 try-restart | condrestart)
98 [ -e /var/lock/subsys/nscd ] && restart
99 RETVAL=$?
101 force-reload | reload)
102 echo -n $"Reloading $prog: "
103 killproc /usr/sbin/nscd -HUP
104 RETVAL=$?
105 echo
108 echo $"Usage: $0 {start|stop|status|restart|reload|condrestart}"
109 RETVAL=1
111 esac
112 exit $RETVAL