1998-01-31 09:39:55 +01:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# nscd: Starts the Name Switch Cache Daemon
|
|
|
|
#
|
1998-08-31 13:11:15 +02:00
|
|
|
# chkconfig: - 30 80
|
|
|
|
# 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 only if you use \
|
1998-01-31 09:39:55 +01:00
|
|
|
# slow Services like NIS or NIS+
|
1999-08-17 03:37:38 +02:00
|
|
|
# processname: nscd
|
1998-08-31 13:11:15 +02:00
|
|
|
# config: /etc/nscd.conf
|
|
|
|
#
|
|
|
|
|
|
|
|
# Sanity checks.
|
|
|
|
[ -f /etc/nscd.conf ] || exit 0
|
|
|
|
[ -x /usr/sbin/nscd ] || exit 0
|
1998-01-31 09:39:55 +01:00
|
|
|
|
|
|
|
# Source function library.
|
|
|
|
. /etc/rc.d/init.d/functions
|
|
|
|
|
1999-08-17 03:37:38 +02:00
|
|
|
# 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
|
|
|
|
|
1998-01-31 09:39:55 +01:00
|
|
|
# See how we were called.
|
|
|
|
case "$1" in
|
|
|
|
start)
|
|
|
|
secure=""
|
1999-08-17 03:37:38 +02:00
|
|
|
# for table in passwd group
|
|
|
|
# do
|
|
|
|
# if egrep '^'$table':.*nisplus' /etc/nsswitch.conf >/dev/null
|
|
|
|
# then
|
|
|
|
# /usr/lib/nscd_nischeck $table ||
|
|
|
|
# secure="$secure -S $table,yes"
|
|
|
|
# fi
|
|
|
|
# done
|
1998-01-31 09:39:55 +01:00
|
|
|
echo -n "Starting Name Switch Cache Daemon: "
|
|
|
|
daemon nscd $secure
|
1999-08-17 03:37:38 +02:00
|
|
|
RETVAL=$?
|
1998-01-31 09:39:55 +01:00
|
|
|
echo
|
1999-08-17 03:37:38 +02:00
|
|
|
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/nscd
|
1998-01-31 09:39:55 +01:00
|
|
|
;;
|
|
|
|
stop)
|
|
|
|
echo -n "Stopping Name Switch Cache Daemon: "
|
|
|
|
/usr/sbin/nscd -K
|
1999-08-17 03:37:38 +02:00
|
|
|
RETVAL=$?
|
|
|
|
if [ $RETVAL -eq 0 ]; then
|
|
|
|
rm -f /var/lock/subsys/nscd
|
|
|
|
echo nscd
|
|
|
|
else
|
|
|
|
echo
|
|
|
|
fi
|
1998-01-31 09:39:55 +01:00
|
|
|
;;
|
|
|
|
status)
|
|
|
|
status nscd
|
1999-08-17 03:37:38 +02:00
|
|
|
RETVAL=$?
|
1998-01-31 09:39:55 +01:00
|
|
|
;;
|
|
|
|
restart)
|
|
|
|
$0 stop
|
|
|
|
$0 start
|
1999-08-17 03:37:38 +02:00
|
|
|
RETVAL=$?
|
|
|
|
;;
|
|
|
|
reload)
|
|
|
|
killproc -HUP nscd
|
|
|
|
RETVAL=$?
|
1998-01-31 09:39:55 +01:00
|
|
|
;;
|
|
|
|
*)
|
1998-08-31 13:11:15 +02:00
|
|
|
echo "Usage: $0 {start|stop|status|restart}"
|
1998-01-31 09:39:55 +01:00
|
|
|
;;
|
|
|
|
esac
|
1999-08-17 03:37:38 +02:00
|
|
|
exit $RETVAL
|