]> sourceware.org Git - glibc.git/blame - nscd/nscd.init
(nscd_init): Non-persistent database files are created with the _PATH_NSCD_XYZ_DB_TMP...
[glibc.git] / nscd / nscd.init
CommitLineData
520ec963 1#!/bin/bash
d67281a7
UD
2#
3# nscd: Starts the Name Switch Cache Daemon
4#
520ec963 5# chkconfig: - 30 74
ac72fbb1
UD
6# description: This is a daemon which handles passwd and group lookups \
7# for running programs and cache the results for the next \
520ec963
UD
8# query. You should start this daemon if you use \
9# slow naming services like NIS, NIS+, LDAP, or hesiod.
10# processname: /usr/sbin/nscd
ac72fbb1
UD
11# config: /etc/nscd.conf
12#
13
14# Sanity checks.
15[ -f /etc/nscd.conf ] || exit 0
16[ -x /usr/sbin/nscd ] || exit 0
d67281a7
UD
17
18# Source function library.
520ec963 19. /etc/init.d/functions
d67281a7 20
aa6adf82
UD
21# nscd does not run on any kernel lower than 2.2.0 because of threading
22# problems, so we require that in first place.
23case $(uname -r) in
24 2.[2-9].*)
25 # this is okay
26 ;;
27 [3-9]*)
28 # these are of course also okay
29 ;;
30 *)
31 #this is not
32 exit 0
33 ;;
34esac
35
36RETVAL=0
520ec963
UD
37prog=nscd
38
39start () {
40 [ -d /var/run/nscd ] || mkdir /var/run/nscd
41 secure=""
42# for table in passwd group hosts
43# do
44# if egrep -q '^'$table':.*nisplus' /etc/nsswitch.conf; then
45# /usr/lib/nscd_nischeck $table || secure="$secure -S $table,yes"
46# fi
47# done
48 echo -n $"Starting $prog: "
49 daemon /usr/sbin/nscd $secure
50 RETVAL=$?
51 echo
52 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/nscd
53 return $RETVAL
54}
55
56stop () {
57 echo -n $"Stopping $prog: "
58 /usr/sbin/nscd -K
59 RETVAL=$?
60 if [ $RETVAL -eq 0 ]; then
61 rm -f /var/lock/subsys/nscd
62 # nscd won't be able to remove these if it is running as
63 # a non-privileged user
64 rm -f /var/run/nscd/nscd.pid
aadd7d9d 65 rm -f /var/run/nscd/socket
520ec963
UD
66 success $"$prog shutdown"
67 else
68 failure $"$prog shutdown"
69 fi
70 echo
71 return $RETVAL
72}
73
74restart() {
75 stop
76 start
77}
aa6adf82 78
d67281a7
UD
79# See how we were called.
80case "$1" in
81 start)
520ec963 82 start
aa6adf82 83 RETVAL=$?
d67281a7
UD
84 ;;
85 stop)
520ec963 86 stop
aa6adf82 87 RETVAL=$?
d67281a7 88 ;;
520ec963 89 status)
d67281a7 90 status nscd
aa6adf82 91 RETVAL=$?
d67281a7 92 ;;
520ec963
UD
93 restart)
94 restart
95 RETVAL=$?
96 ;;
97 condrestart)
98 [ -e /var/lock/subsys/nscd ] && restart
aa6adf82
UD
99 RETVAL=$?
100 ;;
520ec963
UD
101 reload)
102 killproc /usr/sbin/nscd -HUP
aa6adf82 103 RETVAL=$?
d67281a7
UD
104 ;;
105 *)
520ec963
UD
106 echo $"Usage: $0 {start|stop|status|restart|reload|condrestart}"
107 RETVAL=1
d67281a7
UD
108 ;;
109esac
aa6adf82 110exit $RETVAL
This page took 0.208211 seconds and 5 git commands to generate.