I'm starting gunicorn with the Django command python manage.py run_gunicorn
. How can I stop gunicorn properly?
Note: I have a semi-automated server deployment with fabric. Thus using something like ps aux | grep gunicorn
to kill the process manually by pid is not an option.
One option would be to use Supervisor
to manage Gunicorn.
Then again i don't see why you can't kill the process via Fabric
.
Assuming you let Gunicorn write a pid file you could easily read that file in a Fabric
command.
Something like this should work:
run("kill `cat /path/to/your/file/gunicorn.pid`")