如何停止以 "detached" 模式启动的 Elixir 应用程序?

How to stop Elixir application started in "detached" mode?

我使用以下命令启动了我的应用程序:

elixir --erl "-detached" -S mix phx.server

如何stop/restart流程?

已找到答案 here

假设 UNIX-like 系统:

ps aux | grep elixir

找到 OS-process 的 process-id 运行已加载 elixir 和你的 phoenix 应用程序的 Erlang VM,然后

kill number

阻止它。 number 是 ps aux 输出的第二列中的数字(第一列包含拥有进程的 unix-user 的名称,即启动进程)。 之后你可以尝试 ps aux |再次 grep elixir 以确保它不再存在。

在实际生产环境中,建议您改为设置例如管理进程的 systemd 条目,这使得 start/stop/restart/autostart-at-boot 和监视它变得容易得多。