Richard A Downing wrote:
> Why not use 'rpc.nfsd -- 0'? This tells the kernel [nfsd] threads to
> cease and desist - well it actually says to kernel that you want zero of
> them.
Interesting. I also checked RH's solution and they do a kill with the
default signal:
stop)
# Stop daemons.
echo -n $"Shutting down NFS mountd: "
killproc rpc.mountd
echo
echo -n $"Shutting down NFS daemon: "
killproc nfsd
echo
if [ -n "$RQUOTAD" ]; then
echo -n "Shutting down NFS quotas: "
killproc rpc.rquotad
echo
fi
# Do it the last so that clients can still access the server
# when the server is running.
action $"Shutting down NFS services: " /usr/sbin/exportfs -au
rm -f /var/lock/subsys/nfs
;;
where the interesting part of killproc is:
if [ -z "$pid" ]; then
pid=`pidof -o $$ -o $PPID -o %PPID -x $1 || \
pidof -o $$ -o $PPID -o %PPID -x $base`
fi
# Kill it.
if [ -n "${pid:-}" ] ; then
[ "$BOOTUP" = "verbose" -a -z "$LSB" ] && echo -n "$base "
if [ "$notset" -eq "1" ] ; then
if checkpid $pid 2>&1; then
# TERM first, then KILL if not dead
-----> kill -TERM $pid
usleep 100000
if checkpid $pid &&
sleep 1 &&
checkpid $pid &&
sleep 3 &&
checkpid $pid ; then
kill -KILL $pid
usleep 100000
fi
fi
checkpid $pid
RC=$?
[ "$RC" -eq 0 ] &&
failure $"$base shutdown" ||
success $"$base shutdown"
RC=$((! $RC))
# use specified level only
else
if checkpid $pid; then
kill $killlevel $pid
RC=$?
[ "$RC" -eq 0 ] && success $"$base $killlevel" || \
failure $"$base $killlevel"
fi
fi
else
failure $"$base shutdown"
RC=1
fi
This uses the $pid variable which kills all of the nfsd threads at once,
first with a TERM, then, if necessary with a KILL. Note that if the
first command succeeds, the wait is only 0.1 second.
Although Richard's technique is interesting, I prefer the well known
kill method. However, any method that works reliably is OK with me.
-- Bruce
--
http://linuxfromscratch.org/mailman/listinfo/blfs-dev
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page