Subversion Repositories configs

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
4 - 1
#!/bin/bash
2
#
3
# nscd:		Starts the Name Switch Cache Daemon
4
#
5
# chkconfig: - 30 74
6
# description:  This is a daemon which handles passwd and group lookups \
7
#		for running programs and cache the results for the next \
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
11
# config: /etc/nscd.conf
12
# config: /etc/sysconfig/nscd
13
#
14
### BEGIN INIT INFO
15
# Provides: nscd
16
# Required-Start: $syslog
17
# Default-Stop: 0 1 6
18
# Short-Description: Starts the Name Switch Cache Daemon
19
# Description:  This is a daemon which handles passwd and group lookups \
20
#		for running programs and cache the results for the next \
21
#		query.  You should start this daemon if you use \
22
#		slow naming services like NIS, NIS+, LDAP, or hesiod.
23
### END INIT INFO
24
 
25
# Sanity checks.
26
[ -f /etc/nscd.conf ] || exit 0
27
[ -x /usr/sbin/nscd ] || exit 0
28
 
29
# Source function library.
30
. /etc/init.d/functions
31
 
32
# Source an auxiliary options file if we have one, and pick up NSCD_OPTIONS.
33
[ -r /etc/sysconfig/nscd ] && . /etc/sysconfig/nscd
34
 
35
RETVAL=0
36
prog=nscd
37
 
38
start () {
39
    [ -d /var/run/nscd ] || mkdir /var/run/nscd
40
    [ -d /var/db/nscd ] || mkdir /var/db/nscd
41
    echo -n $"Starting $prog: "
42
    daemon /usr/sbin/nscd $NSCD_OPTIONS
43
    RETVAL=$?
44
    echo
45
    [ $RETVAL -eq 0 ] && touch /var/lock/subsys/nscd
46
    return $RETVAL
47
}
48
 
49
stop () {
50
    echo -n $"Stopping $prog: "
51
    /usr/sbin/nscd -K
52
    RETVAL=$?
53
    if [ $RETVAL -eq 0 ]; then
54
       	rm -f /var/lock/subsys/nscd
55
	# nscd won't be able to remove these if it is running as
56
	# a non-privileged user
57
	rm -f /var/run/nscd/nscd.pid
58
	rm -f /var/run/nscd/socket
59
       	success $"$prog shutdown"
60
    else
61
       	failure $"$prog shutdown"
62
    fi
63
    echo
64
    return $RETVAL
65
}
66
 
67
restart() {
68
    stop
69
    start
70
}
71
 
72
# See how we were called.
73
case "$1" in
74
    start)
75
	[ -e /var/lock/subsys/nscd ] || start
76
	RETVAL=$?
77
	;;
78
    stop)
79
	[ ! -e /var/lock/subsys/nscd ] || stop
80
	RETVAL=$?
81
	;;
82
    status)
83
	status nscd
84
	RETVAL=$?
85
	;;
86
    restart)
87
	restart
88
	RETVAL=$?
89
	;;
90
    try-restart | condrestart)
91
	[ ! -e /var/lock/subsys/nscd ] || restart
92
	RETVAL=$?
93
	;;
94
    force-reload | reload)
95
    	echo -n $"Reloading $prog: "
96
    	RETVAL=0
97
    	/usr/sbin/nscd -i passwd || RETVAL=$?
98
    	/usr/sbin/nscd -i group || RETVAL=$?
99
    	/usr/sbin/nscd -i hosts || RETVAL=$?
100
    	/usr/sbin/nscd -i services || RETVAL=$?
101
    	echo
102
	;;
103
    *)
104
	echo $"Usage: $0 {start|stop|status|restart|reload|condrestart}"
105
	RETVAL=1
106
	;;
107
esac
108
exit $RETVAL