Kill via Cron...

George Davidovich freebsd at optimis.net
Tue Apr 20 21:05:56 UTC 2010


On Tue, Apr 20, 2010 at 12:57:25PM -0700, Randal L. Schwartz wrote:
> > > > >> "Karl" == Karl Vogel <vogelke at hcst.com> writes:
> 
> > > > On Tue, 20 Apr 2010 08:52:58 +0100, 
> > > > "mcoyles" <mcoyles at 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


More information about the freebsd-questions mailing list