<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=""><div class="">Hello,</div><div class=""><br class=""></div><div class="">This is business as usual. If you generate myapp release and deploy it to /usr/local then you can create very simple script to init.d</div><div class=""><br class=""></div><div class="">See it here</div><div class=""><a href="https://github.com/fogfish/hyperion/blob/master/rel/deploy.sh#L19" class="">https://github.com/fogfish/hyperion/blob/master/rel/deploy.sh#L19</a></div><div class=""><br class=""></div><div class="">e.g.</div><div class=""><br class=""></div><div class=""><span style="color: rgb(24, 54, 145); font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; line-height: 16px; white-space: pre; background-color: rgb(255, 255, 255);" class="">#!/bin/bash</span></div><div class=""><span style="color: rgb(24, 54, 145); font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; line-height: 16px; white-space: pre; background-color: rgb(255, 255, 255);" class="">export HOME=/root</span></div><div class=""><span class="pl-smi" style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; line-height: 16px; white-space: pre; background-color: rgb(255, 255, 255);"><font color="#183691" class="">/usr/local</font></span><span style="color: rgb(24, 54, 145); font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; line-height: 16px; white-space: pre; background-color: rgb(255, 255, 255);" class="">/</span><span style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; line-height: 16px; white-space: pre; background-color: rgb(255, 255, 255);" class=""><font color="#333333" class="">myapp</font></span><span style="color: rgb(24, 54, 145); font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; line-height: 16px; white-space: pre; background-color: rgb(255, 255, 255);" class="">/bin/</span><span style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; line-height: 16px; white-space: pre; background-color: rgb(255, 255, 255);" class=""><font color="#333333" class="">myapp $1</font></span></div><div class=""><br class=""></div><div class="">- Dmitry</div><div class=""><br class=""></div><br class=""><div><blockquote type="cite" class=""><div class="">On 12 May 2015, at 20:28, Roberto Ostinelli <<a href="mailto:roberto.ostinelli@widetag.com" class="">roberto.ostinelli@widetag.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="content-type" content="text/html; charset=utf-8" class=""><div dir="auto" class=""><div class="">Hi Dmitry,</div><div class="">I am using rebar to generate the release. Thing is: how do you make the generated script start at boot time of, say, ubuntu? And more importantly, how do you stop it since the pid is unknown to the launching script?<br class=""><br class=""><br class=""></div><div class=""><br class="">On 12/mag/2015, at 18:48, Dmitry Kolesnikov <<a href="mailto:dmkolesnikov@gmail.com" class="">dmkolesnikov@gmail.com</a>> wrote:<br class=""><br class=""></div><blockquote type="cite" class=""><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div class="">Hello Roberto,</div><div class=""><br class=""></div><div class="">The rebar makes a dirty work to generate "node release” and necessary bootstrap scripts.  Please check create-node command and concept of erlang releases: </div><div class=""><a href="https://github.com/rebar/rebar/wiki/Rebar-commands" class="">https://github.com/rebar/rebar/wiki/Rebar-commands</a></div><div class=""><a href="http://www.erlang.org/doc/man/reltool.html" class="">http://www.erlang.org/doc/man/reltool.html</a></div><div class=""><br class=""></div><div class="">It generates script looks something similar to this one. It also hooks the heart to watchdog the node.  </div><div class=""><a href="https://github.com/fogfish/hyperion/blob/master/rel/files/hyperion" class="">https://github.com/fogfish/hyperion/blob/master/rel/files/hyperion</a></div><div class=""><br class=""></div><div class="">Personally, I am following an idea to package the application to release and ship it to destination hosts.</div><div class="">Long time ago, I’ve made an empty “erlang release” project as show-case to study and debug various scenarios. You might look on it here:</div><div class=""><br class=""></div><div class=""><a href="https://github.com/fogfish/hyperion" class="">https://github.com/fogfish/hyperion</a>  </div><div class=""><br class=""></div><div class="">Best Regards, </div><div class="">Dmitry</div><div class=""><br class=""></div><br class=""><div class=""><blockquote type="cite" class=""><div class="">On 12 May 2015, at 19:07, Roberto Ostinelli <<a href="mailto:roberto@widetag.com" class="">roberto@widetag.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Fair enough, however at this point I cannot even a single one of these systems to simply START *and* STOP an Erlang release.<div class="">I can easily start it (on ubuntu, `sudo service myapp start`) but the STOP command will always fail. That's because the init script cannot get a grasp of the BEAM process' pid (for some reason), hence it cannot stop it.<br class=""></div><div class=""><br class=""></div><div class="">Any ideas on how to do that?</div><div class=""><br class=""></div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Tue, May 12, 2015 at 5:52 PM, Jesper Louis Andersen <span dir="ltr" class=""><<a href="mailto:jesper.louis.andersen@gmail.com" target="_blank" class="">jesper.louis.andersen@gmail.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 dir="ltr" class=""><div class="gmail_extra"><span class=""><br class=""><div class="gmail_quote">On Mon, May 11, 2015 at 9:13 PM, Roberto Ostinelli <span dir="ltr" class=""><<a href="mailto:roberto.ostinelli@widetag.com" target="_blank" class="">roberto.ostinelli@widetag.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">In non-erlang systems, I would have standard watchdogs that launch an application on OS boot, and then monitor it and relaunch it if necessary.</blockquote></div><br class=""></span>The heart system in Erlang is a simple watchdog, mostly used if you nothing else that will restart your application. In an SysV init system, there is no automatic watching and restart. In RcNG in FreeBSD, there is no restart. In OpenBSDs rc, there is no automatic restart.</div><div class="gmail_extra"><br class=""></div><div class="gmail_extra">But as you say, many modern init systems also provides watching of the applications it starts, and in that case I wouldn't run with heart enabled. Better to let the system above handle it, and plug into its monitoring/reporting and so on.</div><div class="gmail_extra"><br class=""></div><div class="gmail_extra">Heart is very useful if you start nodes outside the control of the system watchdog though. In that case, they won't be restarted, and you can run heart on those.<span class="HOEnZb"><font color="#888888" class=""><br class=""><br clear="all" class=""><div class=""><br class=""></div>-- <br class=""><div class="">J.</div>
</font></span></div></div>
</blockquote></div><br class=""></div>
_______________________________________________<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" class="">http://erlang.org/mailman/listinfo/erlang-questions</a><br class=""></div></blockquote></div><br class=""></div></blockquote></div></div></blockquote></div><br class=""></body></html>