mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-29 14:01:20 +00:00
457962e5f1
2004-10-15 Ulrich Drepper <drepper@redhat.com> * nscd/nscd.h (_PATH_NSCD_PASSWD_DB): Move to /var/db. (_PATH_NSCD_GROUP_DB): Likewise. (_PATH_NSCD_HOSTS_DB): Likewise. (_PATH_NSCD_XYZ_DB_TMP): New #define, point to /var/run. * nscd/connections.c (nscd_init): Non-persistent database files are created with the _PATH_NSCD_XYZ_DB_TMP path. * nscd/nscd.init: Create /var/db/nscd if necessary.
112 lines
2.1 KiB
Bash
112 lines
2.1 KiB
Bash
#!/bin/bash
|
|
#
|
|
# nscd: Starts the Name Switch Cache Daemon
|
|
#
|
|
# chkconfig: - 30 74
|
|
# description: This is a daemon which handles passwd and group lookups \
|
|
# for running programs and cache the results for the next \
|
|
# query. You should start this daemon if you use \
|
|
# slow naming services like NIS, NIS+, LDAP, or hesiod.
|
|
# processname: /usr/sbin/nscd
|
|
# config: /etc/nscd.conf
|
|
#
|
|
|
|
# Sanity checks.
|
|
[ -f /etc/nscd.conf ] || exit 0
|
|
[ -x /usr/sbin/nscd ] || exit 0
|
|
|
|
# Source function library.
|
|
. /etc/init.d/functions
|
|
|
|
# nscd does not run on any kernel lower than 2.2.0 because of threading
|
|
# problems, so we require that in first place.
|
|
case $(uname -r) in
|
|
2.[2-9].*)
|
|
# this is okay
|
|
;;
|
|
[3-9]*)
|
|
# these are of course also okay
|
|
;;
|
|
*)
|
|
#this is not
|
|
exit 0
|
|
;;
|
|
esac
|
|
|
|
RETVAL=0
|
|
prog=nscd
|
|
|
|
start () {
|
|
[ -d /var/run/nscd ] || mkdir /var/run/nscd
|
|
[ -d /var/db/nscd ] || mkdir /var/db/nscd
|
|
secure=""
|
|
# for table in passwd group hosts
|
|
# do
|
|
# if egrep -q '^'$table':.*nisplus' /etc/nsswitch.conf; then
|
|
# /usr/lib/nscd_nischeck $table || secure="$secure -S $table,yes"
|
|
# fi
|
|
# done
|
|
echo -n $"Starting $prog: "
|
|
daemon /usr/sbin/nscd $secure
|
|
RETVAL=$?
|
|
echo
|
|
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/nscd
|
|
return $RETVAL
|
|
}
|
|
|
|
stop () {
|
|
echo -n $"Stopping $prog: "
|
|
/usr/sbin/nscd -K
|
|
RETVAL=$?
|
|
if [ $RETVAL -eq 0 ]; then
|
|
rm -f /var/lock/subsys/nscd
|
|
# nscd won't be able to remove these if it is running as
|
|
# a non-privileged user
|
|
rm -f /var/run/nscd/nscd.pid
|
|
rm -f /var/run/nscd/socket
|
|
success $"$prog shutdown"
|
|
else
|
|
failure $"$prog shutdown"
|
|
fi
|
|
echo
|
|
return $RETVAL
|
|
}
|
|
|
|
restart() {
|
|
stop
|
|
start
|
|
}
|
|
|
|
# See how we were called.
|
|
case "$1" in
|
|
start)
|
|
start
|
|
RETVAL=$?
|
|
;;
|
|
stop)
|
|
stop
|
|
RETVAL=$?
|
|
;;
|
|
status)
|
|
status nscd
|
|
RETVAL=$?
|
|
;;
|
|
restart)
|
|
restart
|
|
RETVAL=$?
|
|
;;
|
|
condrestart)
|
|
[ -e /var/lock/subsys/nscd ] && restart
|
|
RETVAL=$?
|
|
;;
|
|
reload)
|
|
killproc /usr/sbin/nscd -HUP
|
|
RETVAL=$?
|
|
;;
|
|
*)
|
|
echo $"Usage: $0 {start|stop|status|restart|reload|condrestart}"
|
|
RETVAL=1
|
|
;;
|
|
esac
|
|
exit $RETVAL
|