]> git.pld-linux.org Git - packages/glibc.git/blame - nscd.init
- added dirs for some supported IN locales (bho,brx,doi,mni,sat), used by iok
[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"
37 busy
38 /usr/sbin/nscd -K
39 rm -f /var/lock/subsys/nscd >/dev/null 2>&1
d0f1f4fa 40 ok
41 else
fc29e4cb 42 msg_not_running "Name Switch Cache Daemon"
5d4ed5ed 43 fi
86431a2c
ER
44}
45
6615b296
JB
46condrestart() {
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
7d5fe6c0
ER
56upstart_controlled --except reload
57
58# return true if service is considered "up"
59# with upstart, upstart is consulted
60# otherwise lockfile in subsys must exist
61is_service_up() {
62 use_upstart && is_upstart_running "$1" || [ -f /var/lock/subsys/"$1" ]
63}
64
86431a2c
ER
65RETVAL=0
66# See how we were called.
67case "$1" in
68 start)
6615b296 69 start
86431a2c
ER
70 ;;
71 stop)
6615b296 72 stop
da301058 73 ;;
6615b296
JB
74 restart)
75 stop
76 start
77 ;;
78 try-restart)
79 condrestart 0
80 ;;
81 force-reload)
82 condrestart 7
e4a5a03a 83 ;;
57da80b1 84 reload)
7d5fe6c0 85 if is_service_up nscd; then
2d954354
ER
86 for db in passwd group hosts; do
87 show "Invalidating %s cache" $db; busy
88 nscd -i $db && ok || fail
89 done
90 else
91 msg_not_running "Name Switch Cache Daemon"
92 fi
57da80b1 93 ;;
6615b296
JB
94 status)
95 status nscd
96 exit $?
e4a5a03a 97 ;;
98 *)
6615b296 99 msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}"
2db0604a 100 exit 3
da301058 101esac
d0f1f4fa 102
103exit $RETVAL
This page took 0.079292 seconds and 4 git commands to generate.