How to stop gunicorn_django in virtualenv?
-
18-02-2021 - |
Domanda
I am trying out gunicorn, and I installed it inside a virtualenv with a django site. I got gunicorn running with this command:
gunicorn_django -b 127.0.0.1:9000
Which is all well and good. I haven't setup a bash script or hooked it to upstart (I am on Ubuntu) yet, because I am testing it out.
Meantime, my connection to the server was broken, and thus I lost the console, and I can no longer do CTRL + C to stop the server after reconnecting.
How do I stop gunicorn_django, when it is already running?
Soluzione
The general solution to problems like this is to do ps ax|grep gunicorn
to look for the relevant process, then do kill xxxx
where xxxx is the number in the first column.
Altri suggerimenti
Just found this also - pkill
- which will kill all processes matching the search text:
$ pkill gunicorn
No idea how well supported it is, but can confirm that it works on Ubuntu 12.04
(from http://www.howtogeek.com/howto/linux/kill-linux-processes-easier-with-pkill/)
A faster way:
> kill -9 `ps aux | grep gunicorn | awk '{print $2}'`
updated code
This was a bug that has just been fixed here.