DarthSim / overmind

Process manager for Procfile-based applications and tmux
MIT License
2.87k stars 81 forks source link

Feature request: configure the signal used to stop/restart a particular process #41

Closed smaximov closed 5 years ago

smaximov commented 5 years ago

Erlang/Elixir apps are usually started from within Erlang or Elixir shell (erl and iex, respectively) in development. erl installs a SIGINT handler which displays the so called "BREAK" menu instead of stopping the process:

BREAK: (a)bort (c)ontinue (p)roc info (i)nfo (l)oaded
       (v)ersion (k)ill (D)b-tables (d)istribution

To actually stop the shell, the user have to select the abort command (a) or send SIGINT again. Elixir shell (iex) adopts this behavior.

Consider the following Procfile which runs a RabbitMQ server and a toy Elixir app:

broker: rabbitmq-server
consumer: cd consumer && iex -S mix

Stopping processes run by this Procfile either by sending SIGINT (Ctrl+C) to the overmind process or by running overmind kill works fine because overmind also sends SIGKILL shortly after sending SIGINT (or so it seems). But in order to restart the consumer process I have to run overmind restart consumer twice.

The solution would be to send SIGQUIT instead (4.4 How do I quit the Erlang shell?). Can you add a way to specify the signal used to restart a process? Something like this:

$ overmind restart process1 [process2 process3 ...] \
      --stop-signal=process1:SIGQUIT[,process2:SIGINT,process3:SIGTERM...]
$ OVERMIND_STOP_SIGNAL=process1:SIGQUIT[,process2:SIGINT,process3:SIGTERM...] \
      overmind restart process1 [process2 process3 ...]
RudyOnRails commented 5 years ago

I wonder if this would also satisfy a feature request I thought of today - and that is to be able to stop a specific process. At times I want to just stop the rails process and not everything in our Procfile, for when we need to run migrations and such (in our pre-alpha phase right now we tweaking migration files and run an alias of redodb often.

smaximov commented 5 years ago

There was a PR for this: #28.

DarthSim commented 5 years ago

Added to v2.0

The stop command is also added to v2.0

smaximov commented 5 years ago

Thanks @DarthSim, just tested v2.0.0 and it works like a charm!