From owner-freebsd-stable Sat May 27 8:47: 4 2000 Delivered-To: freebsd-stable@freebsd.org Received: from Awfulhak.org (tun.AwfulHak.org [194.242.139.173]) by hub.freebsd.org (Postfix) with ESMTP id C76E537B7E9; Sat, 27 May 2000 08:46:58 -0700 (PDT) (envelope-from brian@Awfulhak.org) Received: from hak.lan.Awfulhak.org (root@hak.lan.awfulhak.org [172.16.0.12]) by Awfulhak.org (8.9.3/8.9.3) with ESMTP id QAA33795; Sat, 27 May 2000 16:46:36 +0100 (BST) (envelope-from brian@Awfulhak.org) Received: from hak.lan.Awfulhak.org (brian@localhost [127.0.0.1]) by hak.lan.Awfulhak.org (8.9.3/8.9.3) with ESMTP id QAA64909; Sat, 27 May 2000 16:46:26 +0100 (BST) (envelope-from brian@Awfulhak.org) Message-Id: <200005271546.QAA64909@hak.lan.Awfulhak.org> X-Mailer: exmh version 2.1.1 10/15/1999 To: John Baldwin Cc: Randall Hopper , stable@FreeBSD.org, housley@thehousleys.net, brian@hak.lan.Awfulhak.org Subject: Re: killall question In-Reply-To: Message from John Baldwin of "Sat, 27 May 2000 10:49:20 EDT." <20000527144920.WNSL22611.mail.rdc1.va.home.com@john.baldwin.cx> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <64901.959442386.1@hak.lan.Awfulhak.org> Date: Sat, 27 May 2000 16:46:26 +0100 From: Brian Somers Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > > On 27-May-00 Randall Hopper wrote: > > housley@thehousleys.net: > > |Randall Hopper said: > > | > > |> I have a script I run named "newroot". I want to kill it with killall. > > |> > > |> > ps -ax | grep newroot > > |> 842 1 rhh /bin/sh /home/rhh/bin/newroot 360 > > |> > > |You will have to do something like > > | > > |kill `ps -ax | grep newroot | sed -e '^[0-9]*'` > > > > Ok. I thought I'd at least try to use the system version, but sounds like > > it's just not as flexible as killall's on other systems. > > > > Here's the shell script I settled on to override the default /usr/bin/killall: > > > > ps -x | grep "$1" | egrep -v "grep|$0" | awk '{print $1;}' > > % killall grep # killall grepscript There are bad sub-string implications there too.... -- Brian Don't _EVER_ lose your sense of humour ! To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message