简体   繁体   English

Elixir 和 Mix 如何制作守护进程?

[英]How do Elixir with Mix make a daemon?

Elixir & Mix all want to make the server as a daemon. Elixir & Mix 都想让服务器成为守护进程。 There have not been able to find the right way.一直没能找到正确的方法。

In addition, I want to use the erlang reltool.另外,我想使用erlang reltool。

You can use the --detached option to start the runtime system detached from the system console.您可以使用--detached选项启动与系统控制台分离的运行时系统。 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.关于 reltool,您可以在配置 VM 参数时使用exrm并传递-detached (single - )。 The full argument list for the runtime system can be found here: http://erlang.org/doc/man/erl.html运行时系统的完整参数列表可以在这里找到: http : //erlang.org/doc/man/erl.html

You should use --erl "-detached" since Elixir 1.9+.从 Elixir 1.9+ 开始,您应该使用--erl "-detached" 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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM