Question

I am running a tmux server configured by tmuxinator. In one pane my django server is running:

python manage.py run_gunicorn

If i quit tmux by calling the kill-server command, the run_gunicorn command is not killed as i would have expected, but is sent to the background:

$ ps aux | grep gunicorn 
alp       3358  1.0  0.1 126988 21728 ?        S    13:06   0:00 python manage.py run_gunicorn

How can i quit the tmux server while quiting all running processes within?

Was it helpful?

Solution

I have found an alternative by adding a line to my tmuxinator config:

pre: pkill -f "^python manage.py run_gunicorn"

The ^ at the beginning only matches processes which are starting with that command. Without it you would also kill the tmux process itself.

This does not solve the problem with remaining background processes, but it kills any old processes when restarting the tmux session, which is an acceptable workaround in my case.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top