Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

elixir

I started my app using the following command:

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

How can I stop/restart the process?

like image 954
Raphael Rafatpanah Avatar asked Oct 28 '25 15:10

Raphael Rafatpanah


1 Answers

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.

like image 109
Raphael Rafatpanah Avatar answered Oct 31 '25 11:10

Raphael Rafatpanah