Date: Wed, 1 Jun 2016 15:08:19 +0100 From: RW <rwmaillists@googlemail.com> To: freebsd-questions@freebsd.org Subject: Re: Pidfile generated by /usr/sbin/daemon not usable by rc.d script Message-ID: <20160601150819.42657954@gumby.homeunix.com> In-Reply-To: <20160601222416.Q15883@sola.nimnet.asn.au> References: <mailman.4774.1464215826.64914.freebsd-questions@freebsd.org> <20160526193917.C15883@sola.nimnet.asn.au> <6ECB89F6-4410-47D2-AA9B-1EA63B334CF0@wooga.net> <20160601222416.Q15883@sola.nimnet.asn.au>
index | next in thread | previous in thread | raw e-mail
On Wed, 1 Jun 2016 22:58:28 +1000 (EST)
Ian Smith wrote:
> On Wed, 1 Jun 2016 12:13:27 +0200, Adam Lindberg wrote:
> > Sorry for the late reply.
> >
> > What we observed was that the `read _pid _junk < $_pidfile` line
> > did indeed work on the command line, after sourcing /etc/rc.subr.
> > For some strange reason it seems not to work from inside the
> > service script for us.
>
> I just had another look at your foo.rcscript attachment, and bounced
> through all in {/usr/local,}/etc/rc.d for examples. As RW said
> earlier, 'command=yes' appears unlike all the others, in that it does
> not provide the full pathname of the executable. I don't know if
> that matters here.
I did misunderstand that. When I saw 'command=yes' it looked like the
OP was trying to treat command as a flag.
> Also, none of the others (here) need daemon(8) to run, in background
> or otherwise .. are you sure that you require its functionality for
> 'foo'?
Most daemons were written as such. daemon(8) is there for those that
weren't or were written in a scripting language that doesn't support
the double fork.
> For one thing, it seems that daemon keeps the -p pidfile locked
> during execution of the process; might that affect service status,
> stop, etc?
I think the problem is pretty straightforward. If you run this
read _pid _junk < $_pidfile
and $_pidfile doesn't end in a newline, read will wait for one, just as
it would if you typed in a line and didn't hit return.
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20160601150819.42657954>
