ILP32 math changes
[glibc.git] / nscd / nscd.init
bloba882da7d8b0b4338eee1e8fc28fe32c8f34cc8a1
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
13 ### BEGIN INIT INFO
14 # Provides: nscd
15 # Required-Start: $syslog
16 # Default-Stop: 0 1 6
17 # Short-Description: Starts the Name Switch Cache Daemon
18 # Description: This is a daemon which handles passwd and group lookups \
19 # for running programs and cache the results for the next \
20 # query. You should start this daemon if you use \
21 # slow naming services like NIS, NIS+, LDAP, or hesiod.
22 ### END INIT INFO
24 # Sanity checks.
25 [ -f /etc/nscd.conf ] || exit 0
26 [ -x /usr/sbin/nscd ] || exit 0
28 # Source function library.
29 . /etc/init.d/functions
31 # nscd does not run on any kernel lower than 2.2.0 because of threading
32 # problems, so we require that in first place.
33 case $(uname -r) in
34 2.[2-9].*)
35 # this is okay
37 [3-9]*)
38 # these are of course also okay
41 #this is not
42 exit 1
44 esac
46 RETVAL=0
47 prog=nscd
49 start () {
50 [ -d /var/run/nscd ] || mkdir /var/run/nscd
51 [ -d /var/db/nscd ] || mkdir /var/db/nscd
52 echo -n $"Starting $prog: "
53 daemon /usr/sbin/nscd
54 RETVAL=$?
55 echo
56 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/nscd
57 return $RETVAL
60 stop () {
61 echo -n $"Stopping $prog: "
62 /usr/sbin/nscd -K
63 RETVAL=$?
64 if [ $RETVAL -eq 0 ]; then
65 rm -f /var/lock/subsys/nscd
66 # nscd won't be able to remove these if it is running as
67 # a non-privileged user
68 rm -f /var/run/nscd/nscd.pid
69 rm -f /var/run/nscd/socket
70 success $"$prog shutdown"
71 else
72 failure $"$prog shutdown"
74 echo
75 return $RETVAL
78 restart() {
79 stop
80 start
83 # See how we were called.
84 case "$1" in
85 start)
86 start
87 RETVAL=$?
89 stop)
90 stop
91 RETVAL=$?
93 status)
94 status nscd
95 RETVAL=$?
97 restart)
98 restart
99 RETVAL=$?
101 try-restart | condrestart)
102 [ -e /var/lock/subsys/nscd ] && restart
103 RETVAL=$?
105 force-reload | reload)
106 echo -n $"Reloading $prog: "
107 killproc /usr/sbin/nscd -HUP
108 RETVAL=$?
109 echo
112 echo $"Usage: $0 {start|stop|status|restart|reload|condrestart}"
113 RETVAL=1
115 esac
116 exit $RETVAL