<div dir="ltr"><div>OK, I've just re-read your message and it looks like all you need is add `PIDFile` to your unit.<br>systemd will behave as expected: once your main process terminates it will re-read PID<br>from this file (assuming that before dying your old process writes its child's PID) and<br>
set it as MAINPID for your service.<br>`GuessMainPID` becomes useless, and will actually be ignored, as the man says.<br><br>But again, if your daemon is not writing a pidfile now, this way is not<br>“without changing the daemon itself first”. I'm not sure you can make it work<br>
reliably otherwise.<br></div></div><div class="gmail_extra"><br clear="all"><div><div dir="ltr"><div><br></div>--<br>Кирилл Елагин</div></div>
<br><br><div class="gmail_quote">On Mon, May 5, 2014 at 2:03 AM, Gerd v. Egidy <span dir="ltr"><<a href="mailto:lists@egidy.de" target="_blank">lists@egidy.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Кирилл,<br>
<div class=""><br>
> Have you looked into using sd_notify to update MAINPID?<br>
<br>
</div>No, not yet. I have sd_notify on my list of things to look at in the future,<br>
but I wanted to make the service work without changing the daemon itself first.<br>
<br>
Thanks for the hint about this possibility.<br>
<br>
Kind regards,<br>
<br>
Gerd<br>
<br>
</blockquote></div><br></div>