From owner-freebsd-questions Wed Mar 13 20:27: 5 2002 Delivered-To: freebsd-questions@freebsd.org Received: from dambiec.mine.nu (CPE-203-51-29-90.nsw.bigpond.net.au [203.51.29.90]) by hub.freebsd.org (Postfix) with SMTP id 5F6CD37B404 for ; Wed, 13 Mar 2002 20:27:01 -0800 (PST) Received: (qmail 74986 invoked from network); 14 Mar 2002 04:30:13 -0000 Received: from unknown (HELO karunwin2k) (10.0.1.51) by server.dambiec.com with SMTP; 14 Mar 2002 04:30:13 -0000 Message-ID: <003101c1cb18$df923840$3301000a@karunwin2k> From: "Karun" To: "Giorgos Keramidas" Cc: References: <004701c1ca54$77ad8a50$3301000a@karunwin2k> <20020313115333.GF434@hades.hell.gr> <009d01c1caca$95578530$3301000a@karunwin2k> <20020313220840.GB40511@hades.hell.gr> Subject: Re: Process Reaper for Freebsd Date: Thu, 14 Mar 2002 15:27:02 +1000 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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" To: "Karun" Cc: 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