From owner-freebsd-questions@FreeBSD.ORG Tue Apr 20 20:31:09 2010 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0F432106568E for ; Tue, 20 Apr 2010 20:31:09 +0000 (UTC) (envelope-from freebsd@optimis.net) Received: from mail.optimis.net (mail.optimis.net [69.104.191.124]) by mx1.freebsd.org (Postfix) with ESMTP id D4D608FC12 for ; Tue, 20 Apr 2010 20:31:08 +0000 (UTC) Received: from marvin.optimis.net (marvin.optimis.net [192.168.1.3]) by mail.optimis.net (8.14.3/8.14.3) with ESMTP id o3KKV8D8073584; Tue, 20 Apr 2010 13:31:08 -0700 (PDT) (envelope-from freebsd@optimis.net) Received: from marvin.optimis.net (localhost [127.0.0.1]) by marvin.optimis.net (8.14.3/8.14.3) with ESMTP id o3KKV8K4025684; Tue, 20 Apr 2010 13:31:08 -0700 (PDT) (envelope-from freebsd@optimis.net) Received: (from george@localhost) by marvin.optimis.net (8.14.3/8.14.3/Submit) id o3KKV8tV025683; Tue, 20 Apr 2010 13:31:08 -0700 (PDT) (envelope-from freebsd@optimis.net) Date: Tue, 20 Apr 2010 13:31:08 -0700 From: George Davidovich To: freebsd-questions@freebsd.org, questions@freebsd.org Message-ID: <20100420203108.GB18188@marvin.optimis.net> References: <002c01cae05e$7eab3ea0$7c01bbe0$@wakefield.sch.uk> <20100420183859.C52D9BE09@bsd118.wpafb.af.mil> <86r5m9yk0q.fsf@red.stonehenge.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <86r5m9yk0q.fsf@red.stonehenge.com> User-Agent: Mutt/1.5.19 (2009-01-05) Cc: Subject: Re: Kill via Cron... X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Apr 2010 20:31:09 -0000 On Tue, Apr 20, 2010 at 12:57:25PM -0700, Randal L. Schwartz wrote: > > > > >> "Karl" == Karl Vogel writes: > > > > > On Tue, 20 Apr 2010 08:52:58 +0100, > > > > "mcoyles" said: > > M> kill -9 `ps ax | grep backup | grep -v grep | awk '{print $1}'` > > And you don't have to remember grep -v grep if you remember > to use "ps axc" (note the c), since arguments won't show up so the > arguments to grep won't generate a false positive. Alternatively: ps ax | grep [b]ackup | awk '{print $1}' Or to avoid being nominated for something like the Useless Use of Cat award: ps ax | awk '/[b]ackup/ {print $1}' Making use pgrep/pkill would seem to make the most sense. -- George