Making an Ubuntu daemon out of a release while using heart

ori brost <>
Wed Mar 9 19:32:14 CET 2011

I have a release of a server program in Erlang that I would like to turn
into a daemon. Currently I did this by writing a script (based on the
release management script generated by rebar) which runs the Erlang VM
synchronously, and writing an upstart .conf file which runs the script).

My problem is that I want to use erl -heart. I have noticed that the
whenever the VM dies, the heart process restarts it, but then the VM starts
a new heart process and kills the old one. This means I have no permanent
PIDs to follow. I was thinking of implementing my solution by having the
script run a while-loop that will only exit if there is no heart process in
the system (for now, assume there is no other erlang program running on the
machine), and have upstart think that the script is the daemon.

Does anyone have recommendation for a better solution? Or some general
recommendation on how to make a daemon out of an Erlang server? Preferably
using upstart?

Best Regards,

Ori Bar, Software Engineer
Nivertech Ltd


More information about the erlang-questions mailing list