Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do Elixir with Mix make a daemon?

Elixir & Mix all want to make the server as a daemon. There have not been able to find the right way.

In addition, I want to use the erlang reltool.

like image 261
aposto Avatar asked Jun 04 '14 13:06

aposto


2 Answers

You can use the --detached option to start the runtime system detached from the system console. It is meant to be used for running daemons and backgrounds processes:

elixir --detached -S mix run

Regarding reltool, you can use exrm although and pass -detached (single -) when configuring the VM arguments. The full argument list for the runtime system can be found here: http://erlang.org/doc/man/erl.html

like image 190
José Valim Avatar answered Oct 10 '22 23:10

José Valim


You should use --erl "-detached" since Elixir 1.9+. Like this:

MIX_ENV=prod elixir --erl "-detached" -S mix run --no-halt

or for Phoenix:

MIX_ENV=prod elixir --erl "-detached" -S mix phx.server
like image 40
Mikhail Chuprynski Avatar answered Oct 10 '22 22:10

Mikhail Chuprynski