home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.protocols.appletalk
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!caen!umeecs!umn.edu!noc.msc.net!uc.msc.edu!apctrc!wsc!calw0148!zanm03
- From: zanm03@cal.amoco.com (Anthony Mutiso)
- Subject: Re: How to kill CAP programs cleanly?
- In-Reply-To: syen@jupiter.seas.upenn.edu's message of 12 Aug 92 16: 56:57 GMT
- Message-ID: <ZANM03.92Aug18080548@calw0057.cal.amoco.com>
- Sender: news@cal.amoco.com
- Reply-To: anmutiso@cal.amoco.com
- Organization: Decision Support Group/Amoco Canada
- X-Zippy: Awright, which one of you hid my PENIS ENVY?
- References: <85996@netnews.upenn.edu>
- Date: Tue, 18 Aug 1992 15:05:48 GMT
- Lines: 103
-
- >>>>> On 12 Aug 92 16:56:57 GMT, syen@jupiter.seas.upenn.edu (Shih-Cheng Yen) said:
-
- Shih-Cheng> Hi! How do I kill lwsrv and aufs jobs cleanly? Even after
- Shih-Cheng> doing kill -9 <process id> I still see the laserprinter
- Shih-Cheng> and appleshare server on the AppleTalk zone. Doing ps -x
- Shih-Cheng> lists no other processes on the Unix side. When I try to
- Shih-Cheng> access them from the Mac, the message says that they are
- Shih-Cheng> no responding. The only way we have been able to remove
- Shih-Cheng> the entries is to shut down the SUN. I have had to use
- Shih-Cheng> different names everytime I start up aufs as I don't seem
- Shih-Cheng> to be able to get aufs running with the same name.
-
- The following two scripts may be of some help.
-
- list-cap-services
- -------------------------------
- #! /bin/sh
-
- # list all cap services running on this host
- # usage: list-cap-services [-s]
- # the -s options is for a short list with out the command line options.
- #
- # Copyright: Anthony Mutiso (May be freely distributed and altered).
- #
- progname=`basename $0`
- timestamp=`date`
- CAP=/usr/local/lib/cap
- BIN=${CAP}/bin
- LIB=${CAP}/lib
- HOSTNAME=`hostname`
- EXP='atis|aarpd|uab|snitch|aufs|lwsrv|timelord'
- shortlist=0
-
- if [ $# -gt 0 ]; then
- if [ "$1" = "-s" ]; then shortlist=1; fi
- fi
-
- if [ $shortlist -eq 1 ]; then
- ps -axwwww | grep $BIN | egrep -v $progname'|grep|sed' | colrm 7 20 | sed -e s:$BIN/:: -e 's: -.*$::'
- else
- ps -axwwww | grep $BIN | egrep -v $progname'|grep|sed' | colrm 7 20 | sed -e s:$CAP:'<capdir>':g
- fi
- -------------------------------
- kill-cap-services
- -------------------------------
- #! /usr/local/bin/perl
-
- #
- # Copyright: Anthony Mutiso (May be freely distributed and altered).
- #
- # kill all cap services running on this host
- # usage: kill-cap-services [aservice,...]
- split(m|/|,$0); $progname = $_[$#_];
- chop($localhost = `hostname`);
-
- $CAP="/usr/local/lib/cap";
- $ETC="$CAP/etc";
- $BIN="$CAP/bin";
- $list="$ETC/list-cap-services";
- $serviceregexp='atis|uab|snitch|aarpd|lwsrv|aufs|timelord';
-
- $serviceregexp = join('|',split(/[,|]+/,join(',',@ARGV))) if ($#ARGV ge 0);
- open (LIST, "$list |") || die "$progname: <error> could not execute $list\n";
- while (<LIST>) {
- local (@service);
- chop;
- # printf "DB: line: [%s]\n",$_;
- m:^\s*(\d+)\s+.*/bin/(\w+)\s+(.*)$: && do {
- $service[0] = $1; $service[1] = $2; $service[2] = $3;
- };
- # printf "DB: service: [%s]\n",join(":",@service);
- next unless ($service[1] =~ m:$serviceregexp:);
- if ($service[1] =~ m:atis|uab:) {
- printf "%s: sending %s (%d) a %s (%d) signal.\n",$progname,$service[1],$service[0],"SIGTERM",15;
- kill 15, $service[0];
- } elsif ($service[1] =~ m:snitch|aarpd|lwsrv|timelord:) {
- printf "%s: sending %s (%d) a %s (%d) signal.\n",$progname,$service[1],$service[0],"SIGQUIT",3;
- kill 3, $service[0];
- } elsif ($service[1] =~ m:aufs:) {
- printf "%s: sending %s (%d) a %s (%d) signal.\n",$progname,$service[1],$service[0],"SIGHUP",1;
- kill 1, $service[0];
- } else {
- printf "%s: unknown cap service <%s> (skipped).\n",$progname,$service[1];
- }
- }
-
- # done
-
- # Local Variables: #
- # mode: perl #
- # End: #
- -------------------------------
-
- You need to alter the value of BIN to point to your cap bin dir.
- Note one of the scripts is a perl script.
-
- Disclaimer: These scripts are offered as is.
-
- Anthony
- --
- Anthony Mutiso (anmutiso@cal.amoco.com) Life-motto: Logic Rules.
-
-
-