]> git.pld-linux.org Git - packages/glibc.git/blame - nscd.init
Revert "separate dynamic linker instead of just ldconfig"
[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
da301058 16
17# Source function library.
18. /etc/rc.d/init.d/functions
19
02156a25 20# Get sysconfig
d0f1f4fa 21[ -f /etc/sysconfig/nscd ] && . /etc/sysconfig/nscd
e4a5a03a 22
86431a2c 23start() {
d0f1f4fa 24 if [ ! -f /var/lock/subsys/nscd ]; then
bec6c405 25 msg_starting "Name Switch Cache Daemon"
7d9bb8d7 26 daemon /usr/sbin/nscd
d0f1f4fa 27 RETVAL=$?
28 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/nscd
29 else
fc29e4cb 30 msg_already_running "Name Switch Cache Daemon"
d0f1f4fa 31 fi
86431a2c
ER
32}
33
34stop() {
d0f1f4fa 35 if [ -f /var/lock/subsys/nscd ]; then
36 msg_stopping "Name Switch Cache Daemon"
c7329b8f 37 killproc --pidfile /var/run/nscd/nscd.pid nscd -TERM
d0f1f4fa 38 rm -f /var/lock/subsys/nscd >/dev/null 2>&1
d0f1f4fa 39 else
fc29e4cb 40 msg_not_running "Name Switch Cache Daemon"
5d4ed5ed 41 fi
86431a2c
ER
42}
43
6615b296
JB
44condrestart() {
45 if [ -f /var/lock/subsys/nscd ]; then
46 stop
47 start
48 else
49 msg_not_running "Name Switch Cache Daemon"
50 RETVAL=$1
51 fi
52}
53
86431a2c
ER
54RETVAL=0
55# See how we were called.
56case "$1" in
57 start)
6615b296 58 start
86431a2c
ER
59 ;;
60 stop)
6615b296 61 stop
da301058 62 ;;
6615b296
JB
63 restart)
64 stop
65 start
66 ;;
67 try-restart)
68 condrestart 0
69 ;;
70 force-reload)
71 condrestart 7
e4a5a03a 72 ;;
57da80b1 73 reload)
4e3bda50 74 if [ -f /var/lock/subsys/nscd ]; then
2d954354
ER
75 for db in passwd group hosts; do
76 show "Invalidating %s cache" $db; busy
77 nscd -i $db && ok || fail
78 done
79 else
80 msg_not_running "Name Switch Cache Daemon"
81 fi
57da80b1 82 ;;
6615b296
JB
83 status)
84 status nscd
85 exit $?
e4a5a03a 86 ;;
87 *)
6615b296 88 msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}"
2db0604a 89 exit 3
da301058 90esac
d0f1f4fa 91
92exit $RETVAL
This page took 0.082631 seconds and 4 git commands to generate.