]>
Commit | Line | Data |
---|---|---|
9fb0fa33 | 1 | #!/bin/sh |
da301058 | 2 | # |
3 | # nscd: Starts the Name Switch Cache Daemon | |
4 | # | |
d0f1f4fa | 5 | # chkconfig: 345 30 80 |
6 | # description: This is a daemon which handles passwd and group lookups \ | |
da301058 | 7 | # for running programs and cache the results for the next \ |
d0f1f4fa | 8 | # query. You should start this daemon only if you use \ |
da301058 | 9 | # slow Services like NIS or NIS+ |
d0f1f4fa | 10 | # processname: nscd |
11 | # config: /etc/nscd.conf | |
da301058 | 12 | # |
13 | ||
14 | # Sanity checks. | |
15 | [ -f /etc/nscd.conf ] || exit 0 | |
16 | [ -x /usr/sbin/nscd ] || exit 0 | |
17 | ||
18 | # Source function library. | |
19 | . /etc/rc.d/init.d/functions | |
20 | ||
02156a25 | 21 | # Get sysconfig |
d0f1f4fa | 22 | [ -f /etc/sysconfig/nscd ] && . /etc/sysconfig/nscd |
e4a5a03a | 23 | |
2db0604a | 24 | RETVAL=0 |
da301058 | 25 | # See how we were called. |
26 | case "$1" in | |
e4a5a03a | 27 | start) |
d0f1f4fa | 28 | if [ ! -f /var/lock/subsys/nscd ]; then |
bec6c405 | 29 | msg_starting "Name Switch Cache Daemon" |
d0f1f4fa | 30 | daemon nscd |
31 | RETVAL=$? | |
32 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/nscd | |
33 | else | |
fc29e4cb | 34 | msg_already_running "Name Switch Cache Daemon" |
d0f1f4fa | 35 | fi |
e4a5a03a | 36 | ;; |
37 | stop) | |
d0f1f4fa | 38 | if [ -f /var/lock/subsys/nscd ]; then |
39 | msg_stopping "Name Switch Cache Daemon" | |
40 | busy | |
41 | /usr/sbin/nscd -K | |
42 | rm -f /var/lock/subsys/nscd >/dev/null 2>&1 | |
d0f1f4fa | 43 | ok |
44 | else | |
fc29e4cb | 45 | msg_not_running "Name Switch Cache Daemon" |
d0f1f4fa | 46 | fi |
da301058 | 47 | ;; |
48 | status) | |
e4a5a03a | 49 | status nscd |
2db0604a | 50 | exit $? |
e4a5a03a | 51 | ;; |
2db0604a | 52 | restart|force-reload) |
e4a5a03a | 53 | $0 stop |
54 | $0 start | |
2db0604a | 55 | exit $? |
e4a5a03a | 56 | ;; |
57 | *) | |
2db0604a | 58 | msg_usage "$0 {start|stop|restart|force-reload|status}" |
59 | exit 3 | |
da301058 | 60 | esac |
d0f1f4fa | 61 | |
62 | exit $RETVAL |