Date: Mon, 15 Jan 2001 04:39:31 -0600 (CST) From: Mike Meyer <mwm@mired.org> To: "Matthew Emmerton" <matt@gsicomp.on.ca> Cc: questions@freebsd.org Subject: Re: Starting daemons in rc.local Message-ID: <14946.54115.154270.957052@guru.mired.org> In-Reply-To: <71217114@toto.iv>
next in thread | previous in thread | raw e-mail | index | archive | help
> 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. <mike -- Mike Meyer <mwm@mired.org> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?14946.54115.154270.957052>