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

John (EBo) David plug-discuss@lists.PLUG.phoenix.az.us
Thu, 20 Sep 2001 11:13:44 -0700


Thomas Mondoshawan Tate wrote:
> 
> >   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.
> 
> 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)

don't think so because the creation loop:

while 1; do
  `corewar`
  ... do something
done


should run faster than a ps and kill each.  I expect that it will grow
faster then the kill...  What are you thoughts on this?

We could test it by setting up two scripts (corewar and killwar) and
then do a `corewar; sleep 3; killwar`  and see if it dies or lives ;-)

  EBo --