Rebar3 and Erlang -heart flag

Viewed 197

I start my release with a script:

#!/bin/bash
ERL_FLAGS=" -args_file config/vm.args -config config/sys.config" rebar3 shell

I have a -heart command in my vm.args file because I want the node to boot automatically after it crashes, using the script. For manual node crash, I use the command "kill -SEGV pid", and kill the heart_beat_kill_pid. after that, I got a message :

segmentation fault (core dumped) ERL_FLAGS=" -args_file config/vm.args -config config/sys.config" rebar3 shell
heart: Erlang has closed.
heart: Would reboot. Terminating.

and nothing happens.

I think that I don't understand enough about the -heart flag. What do I need to do to deal with the problem of the crashed node?

1 Answers

As per the documentation in https://erlang.org/doc/man/heart.html, HEART_COMMAND environment variable needs to set for the node to restart automatically after crash.

Also, as you seem to be using rebar3, I would recommend setting {extended_start_script, true} in rebar.config (relx properties). This would generate a nice start script that can be used to start the erlang node as a daemon process.

Related