Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Mar 2002 15:27:02 +1000
From:      "Karun" <karun@dambiec.com>
To:        "Giorgos Keramidas" <keramida@ceid.upatras.gr>
Cc:        <freebsd-questions@freebsd.org>
Subject:   Re: Process Reaper for Freebsd
Message-ID:  <003101c1cb18$df923840$3301000a@karunwin2k>
References:  <004701c1ca54$77ad8a50$3301000a@karunwin2k> <20020313115333.GF434@hades.hell.gr> <009d01c1caca$95578530$3301000a@karunwin2k> <20020313220840.GB40511@hades.hell.gr>

next in thread | previous in thread | raw e-mail | index | archive | help
I have modified the reaper script to how i want it. except when i try
running kill 'reaper'
it does not work.
It lists all the process ids which is killed.
I am using freebsd 4.4
Karun
----- Original Message -----
From: "Giorgos Keramidas" <keramida@ceid.upatras.gr>
To: "Karun" <karun@dambiec.com>
Cc: <freebsd-questions@freebsd.org>
Sent: Thursday, March 14, 2002 8:08 AM
Subject: Re: Process Reaper for Freebsd


On 2002-03-14 06:06, Karun wrote:
> What i want to do is kill all background processes except those running by
a
> specific user.

Combine ps(1) and standard FreeBSD tools to filter out a process listing,
and keep only those fields you want (in this case, the PID of the
processes).  Look at the output of the following shell script on your
system:

#!/bin/sh

ps xau | sed -e 1d | grep -v '^root' | grep -v "^${USER}" |\
    awk '{print $2,$7}' | grep '??$' | cut -d' ' -f1

Try removing parts of this pipeline, and see what you get as output.
If you manage to get a listing of the process IDs like the one produced by
the above script, you can easily call kill to do the rest:

$ kill `script.sh`

Giorgos Keramidas                       FreeBSD Documentation Project
keramida@{freebsd.org,ceid.upatras.gr}  http://www.FreeBSD.org/docproj/



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?003101c1cb18$df923840$3301000a>