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

Adam Lindberg adam.lindberg at
Wed May 25 15:12:40 UTC 2016


I don’t know what powerd is and how it factors into this. :-)

We’re trying to create a service script for our own program (an Erlang VM) and hit this “weird behavior”. We were using command=yes as a way to get some program running in the background with daemon wrapped around it. We were able to reproduce the problem with just this minor rc.d script and running ‘yes’ (the executable) as our service. This problem happens no matter what the command is, as far as we can tell.


Adam Lindberg | Backend Engineer
Wooga GmbH | Saarbrücker Str. 38 | D-10405 Berlin

Place of business: Berlin
Registered at the local court Berlin-Charlottenburg, HRB 117846 B
Managing Directors: Jens Begemann, Philipp Möser, Jan Miczaika

> On 25 May 2016, at 15:27 , RW via freebsd-questions <freebsd-questions at> wrote:
> On Wed, 25 May 2016 14:13:47 +0100
> RW wrote:
>> 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 works without a newline. 
> Actually on closer inspection it appears that rc.d/powerd doesn't
> define a pidfile - it's getting shutdown based on the command name. I
> think you should submit a PR.  
> _______________________________________________
> freebsd-questions at mailing list
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at"

More information about the freebsd-questions mailing list