Raphael Rafatpanah
Raphael Rafatpanah

Reputation: 19967

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

I started my app using the following command:

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

How can I stop/restart the process?

Upvotes: 4

Views: 1063

Answers (1)

Raphael Rafatpanah
Raphael Rafatpanah

Reputation: 19967

The answer was found here.

Assuming a UNIX-like system:

ps aux | grep elixir

to find the process-id of the OS-process that runs the Erlang VM that has loaded elixir and your phoenix application, and then

kill number

to stop it. number is the number in the second column of the output of ps aux (the first column containing the name of the unix-user that owns, i.e. started, the process). Afterwards you can try ps aux | grep elixir again to make sure it is no longer there.

In an actual production environment, it is advisable that you instead set up e.g. a systemd entry that manages the process, which makes it a lot easier to start/stop/restart/autostart-at-boot and monitor it.

Upvotes: 5

Related Questions