--Y7xTucakfITjPcLV
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
On Wed, Sep 19, 2001 at 08:31:59AM -0700, John (EBo) David wrote:
> Nathan England wrote:
> >=20
> > >
> > > *** 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
> > >
> >=20
> > Use one of the bootable business cards. Boot that, mount your drive,
> > remove the script, reboot..
> >=20
> > yeah? or did I miss the point?
>=20
> This is what I understood the question to be:=20
>=20
> How does one kill *all* them processes without rebooting the machine.
>=20
> 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.
>=20
> Do I understand the problem correctly?
>=20
> EBo --
Hrm... How about this (in bash and awk):
---
#!/bin/bash
RESULT=3D`ps ax |grep corewar`
while $RESULT; do
for i in $RESULT; do
kill `echo $i |awk '{ $1 }'`
done
RESULT=3D`ps ax |grep corewar`
done
---
That should do it. =3Do)
--=20
Thomas "Mondoshawan" Tate
phoenix@psy.ed.asu.edu
http://tank.dyndns.org
--Y7xTucakfITjPcLV
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see
http://www.gnupg.org
iD8DBQE7qXeVYp5mUsPGjjwRAmAZAKChGJk6JZLmNpUOau+cJhTx1PzY/ACgnD0O
Fq5kDcp6cdLwPBtzkqufShU=
=8YQt
-----END PGP SIGNATURE-----
--Y7xTucakfITjPcLV--