From owner-freebsd-questions Mon Jan 15 2:39:49 2001 Delivered-To: freebsd-questions@freebsd.org Received: from guru.mired.org (okc-65-26-235-186.mmcable.com [65.26.235.186]) by hub.freebsd.org (Postfix) with SMTP id DC2E837B400 for ; Mon, 15 Jan 2001 02:39:31 -0800 (PST) Received: (qmail 21617 invoked by uid 100); 15 Jan 2001 10:39:31 -0000 From: Mike Meyer MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <14946.54115.154270.957052@guru.mired.org> Date: Mon, 15 Jan 2001 04:39:31 -0600 (CST) To: "Matthew Emmerton" Cc: questions@freebsd.org Subject: Re: Starting daemons in rc.local In-Reply-To: <71217114@toto.iv> X-Mailer: VM 6.75 under 21.1 (patch 10) "Capitol Reef" XEmacs Lucid X-face: "5Mnwy%?j>IIV\)A=):rjWL~NB2aH[}Yq8Z=u~vJ`"(,&SiLvbbz2W`;h9L,Yg`+vb1>RG% *h+%X^n0EZd>TM8_IB;a8F?(Fb"lw'IgCoyM.[Lg#r\ Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > Thank you once again for reverting to me. I'm writing to inform you that > I also tried to adapt the example script in rc(8) man page for > 4.2-STABLE but I realized that even though the processes started, they > were not creating the process pid in /var/run. So really i am now into > looking at a way of having the magic pid created.... > > Does anyone know how to achieve this for any process??? Since the shell saves the pid of the most recently started background process in $!, you can do it for any program that doesn't background itself like so: /usr/local/sbin/mydaemon & echo $! > /var/run/mydaemon.pid I'm not sure how this works if you're using an obfuscated shell coding style to do existence tests and the like on the same line as the launch. http://www.mired.org/home/mwm/ Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message