A challenge (was Re: Of course, they'll deny it.)

George Toft plug-discuss@lists.PLUG.phoenix.az.us
Thu, 20 Sep 2001 13:21:05 -0700


I tried something similar:
ps aux | grep corewar | awk '{print $2}' | xargs kill -9

The processes spawn too fast.  I tried your solution - did not
work.  I change the awk to print $1, and it still did not
work.


George



Thomas Mondoshawan Tate wrote:
> 
> On Wed, Sep 19, 2001 at 08:31:59AM -0700, John (EBo) David wrote:
> > Nathan England wrote:
> > >
> > > >
> > > > *** DO NOT TRY THIS UNLESS YOU WANT TO REBOOT ***
> > > > Here's my script:
> > > > #!/bin/bash
> > > >
> > > > while [ 1 ]; do
> > > >         # Make a copy
> > > >         cp corewar corewar.$$
> > > >
> > > >         # Run it
> > > >         ./corewar.$$ &
> > > >
> > > > # Start over
> > > > done
> > > >
> > > > *** DO NOT TRY THIS UNLESS YOU WANT TO REBOOT ***
> > > >
> > > > Here's the challenge: how do you clean up these processes without
> > > > using init 0, init 1, init 6, reboot, or shutdown?
> > > >
> > > > Now I'm guilty of #3, above.
> > > >
> > > > George
> > > >
> > >
> > > Use one of the bootable business cards. Boot that, mount your drive,
> > > remove the script, reboot..
> > >
> > > yeah?  or did I miss the point?
> >
> > This is what I understood the question to be:
> >
> >   How does one kill *all* them processes without rebooting the machine.
> >
> >   Well, if I *know* the name of the program causing the evil behaviour
> > then I can write a awk/perl/sh script that parses the info from a 'ps'
> > and then kills them all in turn.  This could also be done
> > recersively...  The problem though is that the creation loop is likely
> > faster then the seek-and-destroy-process loop.  So that would not likely
> > work either unless you nice your kill process to something like a -19.
> >
> >   Do I understand the problem correctly?
> >
> >   EBo --
> 
> Hrm... How about this (in bash and awk):
> ---
> #!/bin/bash
> 
> RESULT=`ps ax |grep corewar`
> 
> while $RESULT; do
>         for i in $RESULT; do
>                 kill `echo $i |awk '{ $1 }'`
>         done
>         RESULT=`ps ax |grep corewar`
> done
> ---
> 
> That should do it. =o)
> 
> --
> Thomas "Mondoshawan" Tate
> phoenix@psy.ed.asu.edu
> http://tank.dyndns.org
> 
>   ------------------------------------------------------------------------
>    Part 1.2Type: application/pgp-signature