home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / unix / shell / 4555 < prev    next >
Encoding:
Internet Message Format  |  1992-11-06  |  1.6 KB

  1. Path: sparky!uunet!charon.amdahl.com!pacbell.com!decwrl!elroy.jpl.nasa.gov!swrinde!zaphod.mps.ohio-state.edu!saimiri.primate.wisc.edu!ames!agate!doc.ic.ac.uk!uknet!mcsun!news.funet.fi!news.cs.tut.fi!tut!ttn
  2. From: ttn@cs.tut.fi (Tero Nieminen)
  3. Newsgroups: comp.unix.shell
  4. Subject: Re: suicidal kill command ?
  5. Message-ID: <TTN.92Nov6024042@sepelrastas.cs.tut.fi>
  6. Date: 6 Nov 92 02:40:42 GMT
  7. References: <1c7cd5INNk5l@coral.bucknell.edu <mark.719898510@coombs
  8.     <1992Oct31.192155.3021@nic.csu.net
  9.     <1992Nov3.022415.12993@athena.cs.uga.edu>
  10. Organization: Tampere Univ. of Technology, Finland.
  11. Lines: 19
  12. NNTP-Posting-Host: sepelrastas.cs.tut.fi
  13. In-reply-to: david@marie.stat.uga.edu's message of Tue, 3 Nov 1992 02:24:15 GMT
  14.  
  15. In article <1992Nov3.022415.12993@athena.cs.uga.edu> david@marie.stat.uga.edu (David Gundlach) writes:
  16.  
  17.    I don't know of a way to actually make kill do this by itself, but
  18.    I've whipped up a 'kp' script (originally for 'kill program') that
  19.    does the job.  And after all, aren't you suppposed to build new tools
  20.    out of existing ones? ;-)
  21.  
  22.    Here it is, a one-line shell script:
  23.  
  24.    echo "Killing '$1' processes..."; kill $2 `ps -agux | grep $1 | sort | awk '{print $2}'`
  25.  
  26. One useful thing to chek is "which kill". It might say "kill: shell
  27. built-in command". In that case you have to use another kill for the job
  28. (ie. /bin/kill -9 -1). That does the tric on machines over here.
  29.  
  30. At least csh/tcsh users should watch out for this..
  31. --
  32.      Tero Nieminen                 Tampere University of Technology
  33.      ttn@cs.tut.fi                     Tampere, Finland, Europe
  34.