]> git.pld-linux.org Git - packages/glibc.git/blob - nscd.init
rel 8; rebuild with gcc-7.2.0-4
[packages/glibc.git] / nscd.init
1 #!/bin/sh
2 #
3 # nscd:         Starts the Name Switch Cache Daemon
4 #
5 # chkconfig:    345 30 80
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 only if you use \
9 #               slow Services like NIS or NIS+
10 # processname:  nscd
11 # config:       /etc/nscd.conf
12 #
13
14 # Sanity checks.
15 [ -f /etc/nscd.conf ] || exit 0
16
17 # Source function library.
18 . /etc/rc.d/init.d/functions
19
20 # Get sysconfig
21 [ -f /etc/sysconfig/nscd ] && . /etc/sysconfig/nscd
22
23 start() {
24         if [ ! -f /var/lock/subsys/nscd ]; then
25                 msg_starting "Name Switch Cache Daemon"
26                 daemon /usr/sbin/nscd
27                 RETVAL=$?
28                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/nscd
29         else
30                 msg_already_running "Name Switch Cache Daemon"
31         fi
32 }
33
34 stop() {
35         if [ -f /var/lock/subsys/nscd ]; then
36                 msg_stopping "Name Switch Cache Daemon"
37                 busy
38                 /usr/sbin/nscd -K
39                 rm -f /var/lock/subsys/nscd >/dev/null 2>&1
40                 ok
41         else
42                 msg_not_running "Name Switch Cache Daemon"
43         fi
44 }
45
46 condrestart() {
47         if [ -f /var/lock/subsys/nscd ]; then
48                 stop
49                 start
50         else
51                 msg_not_running "Name Switch Cache Daemon"
52                 RETVAL=$1
53         fi
54 }
55
56 RETVAL=0
57 # See how we were called.
58 case "$1" in
59   start)
60         start
61         ;;
62   stop)
63         stop
64         ;;
65   restart)
66         stop
67         start
68         ;;
69   try-restart)
70         condrestart 0
71         ;;
72   force-reload)
73         condrestart 7
74         ;;
75   reload)
76         if [ -f /var/lock/subsys/nscd ]; then
77                 for db in passwd group hosts; do
78                         show "Invalidating %s cache" $db; busy
79                         nscd -i $db && ok || fail
80                 done
81         else
82                 msg_not_running "Name Switch Cache Daemon"
83         fi
84         ;;
85   status)
86         status nscd
87         exit $?
88         ;;
89   *)
90         msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}"
91         exit 3
92 esac
93
94 exit $RETVAL
This page took 0.086632 seconds and 3 git commands to generate.