Adam Lindberg
2016-05-25 09:51:31 UTC
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.
Attached is the service script (âfoo.rcscriptâ) and the output when it is broken, i.e. no newline (âservice-foo-status-without-newline.outputâ) and when it works after manually adding the newline to the pidfile (âservice-foo-status-with-newline.outputâ).
The service script as a âsedâ line commented out, which if enabled will make the service script work. However, it feels like a bit of a hack to modify the pidfile created by âdaemonâ manually afterwards.
Is there a better way to make this work? Is this a bug somehow, either in the service script I wrote or in the rc.subr functions? Any insight would be helpful.
Thanks in advance!
Adam
--
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
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.
Attached is the service script (âfoo.rcscriptâ) and the output when it is broken, i.e. no newline (âservice-foo-status-without-newline.outputâ) and when it works after manually adding the newline to the pidfile (âservice-foo-status-with-newline.outputâ).
The service script as a âsedâ line commented out, which if enabled will make the service script work. However, it feels like a bit of a hack to modify the pidfile created by âdaemonâ manually afterwards.
Is there a better way to make this work? Is this a bug somehow, either in the service script I wrote or in the rc.subr functions? Any insight would be helpful.
Thanks in advance!
Adam
--
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