<div dir="auto"><div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Oct 19, 2021, 08:45 Andrei Borzenkov <<a href="mailto:arvidjaar@gmail.com">arvidjaar@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 18.10.2021 23:08, Silvio Knizek wrote:<br>
> Am Montag, dem 18.10.2021 um 12:43 -0700 schrieb Kenneth Porter:<br>
>> I just installed the new-to-EPEL ndppd service and am seeing this in my log:<br>
>><br>
>> Oct 17 21:10:08 saruman systemd: Can't open PID file<br>
>> /var/run/ndppd/ndppd.pid (yet?) after start: No such file or directory<br>
>><br>
<br>
That is just an information. May be it could be downgraded to debug, at<br>
least initially.<br>
<br>
>> Examining the source, I see that the pidfile is created by the child<br>
>> process, not the parent. I'm guessing that systemd is expecting the pidfile<br>
>> to exist when the parent exits? (I want to file the issue on the upstream<br>
>> program and want to make sure I understand how this should work.)<br>
>><br>
>> Source in question. Note how daemonize() forks and exits and main() invokes<br>
>> daemonize and then creates the pidfile. I'm thinking that daemonize()<br>
>> should create the pidfile before it invokes exit().<br>
>><br>
>> <<a href="https://github.com/DanielAdolfsson/ndppd/blob/master/src/ndppd.cc" rel="noreferrer noreferrer" target="_blank">https://github.com/DanielAdolfsson/ndppd/blob/master/src/ndppd.cc</a>><br>
>><br>
> Hi,<br>
> <br>
> just don't demonize and don't use a PIDFile= at all. systemd is<br>
> actually quite apt in figuring out which process is the right main one.<br>
<br>
It is not about "main process". It is about notifying systemd that your<br>
service is ready and systemd can proceed with After dependencies.<br>
Without PIDFile your service is "ready" as soon as it forked. This most<br>
likely is not correct.<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Not quite as soon as it forked, but as soon as the parent exits.</div><div dir="auto"><br></div><div dir="auto">This doesn't depend on pidfiles, and in general seems to be something that services get right more often than pidfile creation. Initialize, fork, exit in parent.</div></div>