Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

python 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 run_gunicorn

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

share|improve this question
There's a #{pane_pid} format variable. You might be able to use tmux list-panes in conjunction with this in order to get a list of PIDs in a session (or a single window), then send a SIGTERM to them all. – Blacklight Shining Oct 21 '13 at 6:00
up vote 1 down vote accepted

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

pre: pkill -f "^python run_gunicorn"

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

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.