[299] in Info-AFS_Redistribution
Re: AFS Server Shutdown Question
daemon@ATHENA.MIT.EDU (charles j. antonelli)
Tue Aug 27 11:20:00 1991
Date: Tue, 27 Aug 91 10:59:42 -0400
From: charles j. antonelli <cja@ifs.umich.edu>
To: clemc@lccma.bos.locus.com (Clem Cole)
Cc: info-afs@transarc.com, touchstone@lccma.bos.locus.com
In-Reply-To: Your message of Thu, 22 Aug 91 12:09:22 -0400.
>Is there a way to give ``root'' the shutdown authority (since it
>has start up authority from /etc/rc anyway) so we do not want to break
>the standard UNIX start up and shutdown mechanism of so many years.
i ran into this quite a while ago and came up with 'pmbs' to solve it.
basically, you just send the correct signals in the correct order to each
of the servers. the interesting part is getting the pids of the servers;
kbn does that. there are some hacks and race conditions in this solution;
caveat emptor. it has worked fine for us.
charles antonelli
% cat /usr/afs/bin/pmbs
#!/bin/sh
# poor man's bos shutdown
KBN=/usr/vice/bin/kbn
$KBN bosserver
$KBN -QUIT fileserver
$KBN kaserver volserver ptserver vlserver
% cat /usr/afs/bin/kbn
#!/bin/sh
# provides "kill by name" functionality
# derived from spencer thomas' version
SIG=
PROCS='('
while [ -n "$1" ]; do
case $1 in
-*) SIG=$1;;
*) PROCS="$PROCS *$1|";;
esac
shift
done
if [ "x$PROCS" = x\( ]; then echo "Usage: $0 [-sig] names ..."; exit 1; fi
PROCS="${PROCS}mxyptlk)"
PIDS=`ps axc | egrep "$PROCS" | awk '{ print $1 }'`
if [ -n "$PIDS" ]; then
CMD="kill $SIG $PIDS"
echo + $CMD
if [ "$SIG" != '-0' ]; then
$CMD
fi
else
echo "$0: no processes found"
fi