Date: Tue, 20 Apr 2010 13:31:08 -0700 From: George Davidovich <freebsd@optimis.net> To: freebsd-questions@freebsd.org, questions@freebsd.org Subject: Re: Kill via Cron... Message-ID: <20100420203108.GB18188@marvin.optimis.net> In-Reply-To: <86r5m9yk0q.fsf@red.stonehenge.com> References: <002c01cae05e$7eab3ea0$7c01bbe0$@wakefield.sch.uk> <20100420183859.C52D9BE09@bsd118.wpafb.af.mil> <86r5m9yk0q.fsf@red.stonehenge.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Apr 20, 2010 at 12:57:25PM -0700, Randal L. Schwartz wrote:
> > > > >> "Karl" == Karl Vogel <vogelke@hcst.com> writes:
>
> > > > On Tue, 20 Apr 2010 08:52:58 +0100,
> > > > "mcoyles" <mcoyles@horbury.wakefield.sch.uk> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100420203108.GB18188>
