home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / unix / shell / 3707 < prev    next >
Encoding:
Internet Message Format  |  1992-08-31  |  1.0 KB

  1. Xref: sparky comp.unix.shell:3707 comp.unix.questions:10555
  2. Newsgroups: comp.unix.shell,comp.unix.questions,netcom.general
  3. Path: sparky!uunet!usc!sdd.hp.com!news.cs.indiana.edu!syscon!gator!dlpinc00!dlparker
  4. From: dlparker@dlpinc00.rn.com (David L. Parker)
  5. Subject: Re: Need Script To Kill Process Using Substring Of Application Name
  6. Message-ID: <1992Aug31.095604.488@dlpinc00.rn.com>
  7. Organization: Automated Data Management Services
  8. References: <x6gnwvc.westes@netcom.com>
  9. Date: Mon, 31 Aug 1992 09:56:04 GMT
  10. Lines: 16
  11.  
  12. In article <x6gnwvc.westes@netcom.com> westes@netcom.com (Will Estes) writes:
  13. >Does anyone have a script that they could send to me that will take as
  14. >its input some substring and then kill any process you own that has that
  15. >substring in its application name?  So the script would do something
  16.  
  17. To kill a process named upsd:
  18.  
  19. pid=`/bin/ps -e | grep upsd | sed -e 's/^  *//' -e 's/ .*//'`
  20. if [ "${pid}" != "" ]
  21. then
  22.     /bin/kill -9 ${pid}
  23. fi
  24. -- 
  25. Dave Parker
  26. Automated Data Management Services, Pleasant Hill, MO 64080-1331
  27. (816) 987-5167/5218 voice/fax
  28.