]> git.pld-linux.org Git - packages/glibc.git/blame - nscd.init
- skip reload if service is down
[packages/glibc.git] / nscd.init
CommitLineData
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
86431a2c 24start() {
d0f1f4fa 25 if [ ! -f /var/lock/subsys/nscd ]; then
bec6c405 26 msg_starting "Name Switch Cache Daemon"
d0f1f4fa 27 daemon nscd
28 RETVAL=$?
29 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/nscd
30 else
fc29e4cb 31 msg_already_running "Name Switch Cache Daemon"
d0f1f4fa 32 fi
86431a2c
ER
33}
34
35stop() {
d0f1f4fa 36 if [ -f /var/lock/subsys/nscd ]; then
37 msg_stopping "Name Switch Cache Daemon"
38 busy
39 /usr/sbin/nscd -K
40 rm -f /var/lock/subsys/nscd >/dev/null 2>&1
d0f1f4fa 41 ok
42 else
fc29e4cb 43 msg_not_running "Name Switch Cache Daemon"
5d4ed5ed 44 fi
86431a2c
ER
45}
46
47RETVAL=0
48# See how we were called.
49case "$1" in
50 start)
51 start
52 ;;
53 stop)
54 stop
da301058 55 ;;
56 status)
e4a5a03a 57 status nscd
2db0604a 58 exit $?
e4a5a03a 59 ;;
57da80b1 60 reload)
2d954354
ER
61 if [ -f /var/lock/subsys/nscd ]; then
62 for db in passwd group hosts; do
63 show "Invalidating %s cache" $db; busy
64 nscd -i $db && ok || fail
65 done
66 else
67 msg_not_running "Name Switch Cache Daemon"
68 fi
57da80b1 69 ;;
2db0604a 70 restart|force-reload)
86431a2c
ER
71 stop
72 start
e4a5a03a 73 ;;
74 *)
57da80b1 75 msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
2db0604a 76 exit 3
da301058 77esac
d0f1f4fa 78
79exit $RETVAL
This page took 0.050796 seconds and 4 git commands to generate.