Updated to fedora-glibc-20071212T1051
[glibc.git] / nscd / nscd.init
blob8ab3fbf7317d6eccc6e9c71fa5441ae85443e7e8
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 echo -n $"Starting $prog: "
42 daemon /usr/sbin/nscd $NSCD_OPTIONS
43 RETVAL=$?
44 echo
45 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/nscd
46 return $RETVAL
49 stop () {
50 echo -n $"Stopping $prog: "
51 /usr/sbin/nscd -K
52 RETVAL=$?
53 if [ $RETVAL -eq 0 ]; then
54 rm -f /var/lock/subsys/nscd
55 # nscd won't be able to remove these if it is running as
56 # a non-privileged user
57 rm -f /var/run/nscd/nscd.pid
58 rm -f /var/run/nscd/socket
59 success $"$prog shutdown"
60 else
61 failure $"$prog shutdown"
63 echo
64 return $RETVAL
67 restart() {
68 stop
69 start
72 # See how we were called.
73 case "$1" in
74 start)
75 start
76 RETVAL=$?
78 stop)
79 stop
80 RETVAL=$?
82 status)
83 status nscd
84 RETVAL=$?
86 restart)
87 restart
88 RETVAL=$?
90 try-restart | condrestart)
91 [ -e /var/lock/subsys/nscd ] && restart
92 RETVAL=$?
94 force-reload | reload)
95 echo -n $"Reloading $prog: "
96 RETVAL=0
97 /usr/sbin/nscd -i passwd || RETVAL=$?
98 /usr/sbin/nscd -i group || RETVAL=$?
99 /usr/sbin/nscd -i hosts || RETVAL=$?
100 /usr/sbin/nscd -i services || RETVAL=$?
101 echo
104 echo $"Usage: $0 {start|stop|status|restart|reload|condrestart}"
105 RETVAL=1
107 esac
108 exit $RETVAL