Article View: comp.unix.shell
Article #50Re: suicidal kill command ?
From: David Gundlach
Date: Tue, 03 Nov 1992 02:24
Date: Tue, 03 Nov 1992 02:24
31 lines
1448 bytes
1448 bytes
% mccauley@bucknell.edu (robert mccauley `93) writes:
%
% Hello shell world,
Hi there!
%
% How can you make the kill command suicidal? I would
% like to be able to kill all processes belonging to me, in effect
% to log out. kill -9 0 doesn't kill its own process.
%
I don't know of a way to actually make kill do this by itself, but
I've whipped up a 'kp' script (originally for 'kill program') that
does the job. And after all, aren't you suppposed to build new tools
out of existing ones? ;-)
Here it is, a one-line shell script:
echo "Killing '$1' processes..."; kill $2 `ps -agux | grep $1 | sort | awk '{print $2}'`
Hope it's of interest :-)
:-D
--
David Gundlach david@marie.stat.uga.edu
System Support and Integration david@rolf.stat.uga.edu
UGA Statistics david@castor.cs.uga.edu
University of Georgia david@groucho.dev.uga.edu
706/542-3289 or 706/542-5232 BITNET: statuga@uga
"I think, therefore I am wrong." -- me
Technical Details
Message-ID:
<1992Nov3.022415.12993@athena.cs.uga.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!ukma!wupost!emory!athena.cs.uga.edu!marie!davidReferences:
<1c7cd5INNk5l@coral.bucknell.edu <mark.719898510@coombs <1992Oct31.192155.3021@nic.csu.netShow Full Headers
Complete Article Headers
Newsgroups: comp.unix.shell Path: arc1-ca.pugleaf.net!sparky!uunet!ukma!wupost!emory!athena.cs.uga.edu!marie!david From: david@marie.stat.uga.edu (David Gundlach) Subject: Re: suicidal kill command ? Message-ID: <1992Nov3.022415.12993@athena.cs.uga.edu> Sender: news@athena.cs.uga.edu Organization: UGA Statistics Department References: <1c7cd5INNk5l@coral.bucknell.edu <mark.719898510@coombs <1992Oct31.192155.3021@nic.csu.net Date: Tue, 3 Nov 1992 02:24:15 GMT Lines: 33