<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Oh. That’s an interesting idea. I will check that out. Thanks for the pointer.<div class=""><br class=""></div><div class="">Tom.</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Apr 19, 2017, at 23:35, Graham Hay <<a href="mailto:grahamrhay@gmail.com" class="">grahamrhay@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">You can use Type=notify for your service, and then inform systemd of the main pid later (like a forking daemon, with a pidfile, once was). That's how rabbitmq works:<div class=""><br class=""></div><div class=""><a href="https://github.com/binarin/rabbitmq-server/blob/master/src/rabbit.erl#L345" class="">https://github.com/binarin/rabbitmq-server/blob/master/src/rabbit.erl#L345</a><br class=""></div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On 19 April 2017 at 06:51, Tom O'Dowd <span dir="ltr" class=""><<a href="mailto:tpodowd@cloudian.com" target="_blank" class="">tpodowd@cloudian.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="">I’m starting an application using systemd which uses run_erl in daemon mode. When I stop the application though by running init:stop(), run_erl seems to return an exit status of 1 rather than 0 so I always get a failed status for the service rather than an inactive status. I can set systemd SuccessExitStatus=1 to have it treat 1 as a success but then if for example the erlang node did die, it still gets marked as inactive rather than failed.<div class=""><br class=""></div><div class="">Note that if I tell systemd that the MainPID is the pid of the beam process rather than run_erl, systemd spits out a warning</div><div class=""><span style="color:rgb(51,51,51);font-family:Arial,sans-serif;font-size:14px;font-variant-ligatures:normal;background-color:rgb(245,245,245)" class=""> Supervising process 96669 which is not our child. We'll most likely not notice when it exits.</span></div><div class=""><span style="font-variant-ligatures:normal;background-color:rgb(245,245,245)" class=""><span class="">and sure enough, if you kill beam, systemd doesn’t notice.</span></span></div><div class=""><span style="font-variant-ligatures:normal;background-color:rgb(245,245,245)" class=""><span class=""><br class=""></span></span></div><div class=""><span style="font-variant-ligatures:normal;background-color:rgb(245,245,245)" class=""><span class="">Main issue sees to be that run_erl doesn’t return the exiting VM status back as its own status. Currently using 19.2 although will move to 19.3 shortly.</span></span></div><div class=""><span style="font-variant-ligatures:normal;background-color:rgb(245,245,245)" class=""><span class=""><br class=""></span></span></div><div class=""><span style="font-variant-ligatures:normal;background-color:rgb(245,245,245)" class=""><span class="">Any pointers? Been poking around on Google and this doesn’t seem like a common issue so maybe I am doing something wrong.</span></span></div><div class=""><span style="font-variant-ligatures:normal;background-color:rgb(245,245,245)" class=""><span class=""><br class=""></span></span></div><div class=""><span style="font-variant-ligatures:normal;background-color:rgb(245,245,245)" class=""><span class="">Thanks,</span></span></div><div class=""><span style="font-variant-ligatures:normal;background-color:rgb(245,245,245)" class=""><span class=""><br class=""></span></span></div><div class=""><span style="font-variant-ligatures:normal;background-color:rgb(245,245,245)" class=""><span class="">Tom.</span></span></div></div><br class="">______________________________<wbr class="">_________________<br class="">
erlang-questions mailing list<br class="">
<a href="mailto:erlang-questions@erlang.org" class="">erlang-questions@erlang.org</a><br class="">
<a href="http://erlang.org/mailman/listinfo/erlang-questions" rel="noreferrer" target="_blank" class="">http://erlang.org/mailman/<wbr class="">listinfo/erlang-questions</a><br class="">
<br class=""></blockquote></div><br class=""></div>
</div></blockquote></div><br class=""></div></body></html>