parsing ps -ax output and killing processes

From: Rob (rob_at_nospam.com)
Date: 02/15/05


Date: Tue, 15 Feb 2005 11:58:00 GMT

After the success of writing my first script yesterday (thanks guys!) I'm
motivated to move on to something more complex today.
How would I go about doing something like a

ps -ax | grep xxxx

and then killing any processes listed (except for the one running the
command of course). There may not be any processes, I
was thinking to detect that I could write out to a file and check the file
size, but I guess that doesn't really help me if there are
any processes listed. Basically I run a shutdown script which doesn't
always work, then need to verify that the script did work
by seeing if processes are still running and manually killing them if they
arent.



Relevant Pages

  • Re: parsing ps -ax output and killing processes
    ... >> After the success of writing my first script yesterday I'm ... >> by seeing if processes are still running and manually killing them if ...
    (comp.unix.shell)
  • Re: parsing ps -ax output and killing processes
    ... > After the success of writing my first script yesterday I'm ... > by seeing if processes are still running and manually killing them if they ...
    (comp.unix.shell)
  • Re: [WR] round tuits
    ... Jackson Pillock wrote: ... I do, too many projects going, not enough time, priorities lean toward ... I started writing a precinct drama set in a locked psychiatric ward. ... Sent off my script. ...
    (misc.writing)
  • Re: crisis Perl
    ... As to writing good code to begin with, ... the top of the script. ... the "use warnings;" line won't actually change ... recommended declaring variables IN AS SMALL AS SCOPE AS POSSIBLE. ...
    (comp.lang.perl.misc)
  • Marginally archaeaology: Eight scripts that still cant be read
    ... WRITING is one of the greatest inventions in human history. ... literate civilisation at the time of the ... So how do you decipher an unknown script? ... there must be some link to a known language. ...
    (sci.archaeology)