Pidfile generated by /usr/sbin/daemon not usable by rc.d script

RW rwmaillists at googlemail.com
Wed May 25 13:13:51 UTC 2016


On Wed, 25 May 2016 11:51:31 +0200
Adam Lindberg wrote:

> Hi!
> 
> I’m trying to create a minimal rc.d script for a service, and
> discovered that using /usr/sbin/daemon with the -p flag creates a
> pidfile which is not readable by /etc/rc.subr. The pidfile is created
> without a newline, in which case all the service commands stop
> working. That means, running “stop” or “status” prints nothing. If I
> add a newline to the file after the fact, they all start working
> again. Running the service script with debug output, shows the ‘read’
> builtin halting the execution of the script when trying to read the
> pidfile.



This is strange because powerd.pid works without a newline. 

I wouldn't have expected it to work at all because you've set 

   command=yes

I don't know if there's a reason for that, but AFAIK either command or
procname is needed in addition to the pid to verify it's the correct
process - they're matched against the output of ps. 



More information about the freebsd-questions mailing list