Date: Fri, 7 Jun 2002 10:25:50 -0400 (EDT) From: Adrian Filipi-Martin <adrian@ubergeeks.com> To: Larry Rosenman <ler@lerctr.org> Cc: Patrick Calkins <pcalkins@oemsupport.com>, "Stable (stable@freebsd.org)" <stable@FreeBSD.ORG> Subject: Re: OT: Passing kill a pid-file Message-ID: <20020607102016.L76734-100000@lorax.ubergeeks.com> In-Reply-To: <1023418644.351.12.camel@lerlaptop>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020607102016.L76734-100000>