/usr/src/glibc/debian/debhelper.in/nscd.init is in eglibc-source 2.19-0ubuntu6.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | #!/bin/sh
### BEGIN INIT INFO
# Provides: nscd
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starts the Name Service Cache Daemon
### END INIT INFO
#
# nscd: Starts the Name Service Cache Daemon
#
# description: This is a daemon which handles passwd and group lookups
# for running programs and caches the results for the next
# query. You should start this daemon only if you use
# slow Services like NIS or NIS+
PATH="/sbin:/usr/sbin:/bin:/usr/bin"
NAME="nscd"
DESC="Name Service Cache Daemon"
DAEMON="/usr/sbin/nscd"
PIDFILE="/var/run/nscd/nscd.pid"
# Sanity checks.
umask 022
[ -f /etc/nscd.conf ] || exit 0
[ -x "$DAEMON" ] || exit 0
[ -d /var/run/nscd ] || mkdir -p /var/run/nscd
. /lib/lsb/init-functions
start_nscd()
{
# Return
# 0 if daemon has been started or was already running
# 2 if daemon could not be started
start-stop-daemon --start --quiet --pidfile "$PIDFILE" --exec "$DAEMON" --test > /dev/null || return 0
start-stop-daemon --start --quiet --pidfile "$PIDFILE" --exec "$DAEMON" || return 2
}
stop_nscd()
{
# Return
# 0 if daemon has been stopped
# 1 if daemon was already stopped
# 2 if daemon could not be stopped
# we try to stop using nscd --shutdown, that fails also if nscd is not present.
# in that case, fallback to "good old methods"
RETVAL=0
if ! $DAEMON --shutdown; then
start-stop-daemon --stop --quiet --pidfile "$PIDFILE" --name "$NAME" --test > /dev/null
RETVAL="$?"
[ "$?" -ne 0 -a "$?" -ne 1 ] && return 2
fi
# Wait for children to finish too
start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec "$DAEMON" > /dev/null
[ "$?" -ne 0 -a "$?" -ne 1 ] && return 2
rm -f "$PIDFILE"
return "$RETVAL"
}
status()
{
# Return
# 0 if daemon is stopped
# 1 if daemon is running
start-stop-daemon --start --quiet --pidfile "$PIDFILE" --exec "$DAEMON" --test > /dev/null || return 1
return 0
}
case "$1" in
start)
log_daemon_msg "Starting $DESC" "$NAME"
start_nscd
case "$?" in
0) log_end_msg 0 ; exit 0 ;;
1) log_warning_msg " (already running)." ; exit 0 ;;
*) log_end_msg 1 ; exit 1 ;;
esac
;;
stop)
log_daemon_msg "Stopping $DESC" "$NAME"
stop_nscd
case "$?" in
0) log_end_msg 0 ; exit 0 ;;
1) log_warning_msg " (not running)." ; exit 0 ;;
*) log_end_msg 1 ; exit 1 ;;
esac
;;
restart|force-reload)
log_daemon_msg "Restarting $DESC" "$NAME"
for table in passwd group hosts ; do
$DAEMON --invalidate $table
done
stop_nscd
case "$?" in
0|1)
start_nscd
case "$?" in
0) log_end_msg 0 ; exit 0 ;;
1) log_failure_msg " (failed -- old process is still running)." ; exit 1 ;;
*) log_failure_msg " (failed to start)." ; exit 1 ;;
esac
;;
*)
log_failure_msg " (failed to stop)."
exit 1
;;
esac
;;
status)
log_daemon_msg "Status of $DESC service: "
status
case "$?" in
0) log_failure_msg "not running." ; exit 3 ;;
1) log_success_msg "running." ; exit 0 ;;
esac
;;
*)
echo "Usage: /etc/init.d/$NAME {start|stop|force-reload|restart|status}" >&2
exit 1
;;
esac
|