From owner-freebsd-stable Fri Jun 7 7:25:58 2002 Delivered-To: freebsd-stable@freebsd.org Received: from mail.ubergeeks.com (lorax.ubergeeks.com [209.145.65.55]) by hub.freebsd.org (Postfix) with ESMTP id AAB5737B407 for ; Fri, 7 Jun 2002 07:25:51 -0700 (PDT) Received: from mail.ubergeeks.com (localhost [127.0.0.1]) by mail.ubergeeks.com (8.12.3/8.12.3) with ESMTP id g57EPoNS080808; Fri, 7 Jun 2002 10:25:50 -0400 (EDT) (envelope-from adrian@ubergeeks.com) Received: from localhost (adrian@localhost) by mail.ubergeeks.com (8.12.3/8.12.3/Submit) with ESMTP id g57EPodL080805; Fri, 7 Jun 2002 10:25:50 -0400 (EDT) (envelope-from adrian@ubergeeks.com) X-Authentication-Warning: lorax.ubergeeks.com: adrian owned process doing -bs Date: Fri, 7 Jun 2002 10:25:50 -0400 (EDT) From: Adrian Filipi-Martin Reply-To: Adrian Filipi-Martin To: Larry Rosenman Cc: Patrick Calkins , "Stable (stable@freebsd.org)" Subject: Re: OT: Passing kill a pid-file In-Reply-To: <1023418644.351.12.camel@lerlaptop> Message-ID: <20020607102016.L76734-100000@lorax.ubergeeks.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On 6 Jun 2002, Larry Rosenman wrote: > On Thu, 2002-06-06 at 21:55, Patrick Calkins wrote: > > Slightly (ok, extremely) off topic - I know its simple, but I am going nuts > > finding it... > > how do I pass 'kill' a pid that lives in a file?? I am writing a .sh script > > to shutdown one of my daemons, and the pid is in a file... > > I keep thinking its something like kill -9 && cat '/bla/bla/my.pid' > > kill -9 `cat /bla/bla/my.pid` > > note that the quotes are back ticks. If you are not stuck on back-ticks because you've use them for 15+ years, I suggest you use the more modern $() syntax. The above would read as follows: kill -KILL $(cat /bla/bla/my.pid) Note that because the opening and closing markers are different, you can nest using this syntax. e.g. kill -KILL $(echo $(cat /bla/bla/my.pid)) A silly example, but it come in handy and people often mix up forward- and back-ticks. BTW, using magic numbers where there is a symbolic representation available is old-shcool also. Yes, SIGKILL is always 9, but some of the other signals have numbers that change from platform to platform. Yes, I'm a recovering language-laywer. ;-) cheers, Adrian -- [ adrian@ubergeeks.com ] To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message