<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Feb 16, 2015 at 10:36 PM, Holger Hans Peter Freyther <span dir="ltr"><<a href="mailto:holger@freyther.de" target="_blank">holger@freyther.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Mon, Feb 16, 2015 at 11:21:53AM +0100, Lennart Poettering wrote:<br>
><br>
> Is your pppd daemon itself also a systemd service?<br>
><br>
> What precisely does "monitor" consist of for this case?<br>
<br>
</span>Yes, the pppd is invoked by systemd as a service. What I am<br>
doing right now is:<br>
<br>
link.service:<br>
ExecStart=pppd call uplink ... nodetach<br>
<br>
/etc/ppp/ip-up.d/NN-linkmon:<br>
linkmon -i $PPP_IFACE -d 8.8.8.8 -p `cat /run/${PPP_IFACE}.pid` &<br>
<br>
<br>
The monitoring right now involves simple ICMP request and<br>
depending on the outcome I change the metric of one of the<br>
default routes. So in case some amount of packet loss is<br>
reached the linkmon will SIGKILL the pid provided.<br>
<span class=""><br>
> We have watchdog support already, with sd_notify(0, "WATCHDOG=1"), and<br>
> WatchdogSec=. But that requires you to run your pppd as a service of<br>
> its own, to be useful.<br>
<br>
</span>I thought the sd_notify is only possible by the "main"<br>
application that got started? E.g. in the above case the<br>
linkmon would be a child of pppd. My application wouldn't<br>
run until pppd has setup the link. This means I would need<br>
to configure a high enough timeout to cope with a potential<br>
bigger set-up time.<br></blockquote><div><br></div><div>NotifyAccess=</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
One nice thing for an external watchdog started by the<br>
NN-linkmon script would be that it would be under pid1<br>
control (e.g. if it is crashing, the other service would<br>
be taken down by systemd), I could have different privileges<br>
for the monitoring system (currently at least one part of<br>
it must be able to send a kill to a parent process).<br></blockquote><div><br></div><div>You can ask systemd to stop or reload a service.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Another neat feature would be if applications could<br>
communicate some extra (custom) status to systemd. E.g.<br>
in the case of pppd to indicate the state of the link-setup,<br>
for something like our BTS process to indicate if it is<br>
currently broadcasting or muted.<br></blockquote><div><br></div><div>sd_notify("STATUS=Reticulating splines");</div><div><br></div><div>sd_notify("READY=1\nSTATUS=Connected.");</div><div><br></div></div>-- <br><div class="gmail_signature"><div dir="ltr">Mantas Mikulėnas <<a href="mailto:grawity@gmail.com" target="_blank">grawity@gmail.com</a>></div></div>
</div></div>