Here is my current configuration file for the service:
description "My App"
author "Me"
start on runlevel [2345]
stop on runlevel [016]
respawn
respawn limit 99 5
chdir /home/ubuntu/myapp/
script
exec /home/ubuntu/.virtualenvs/myapp/bin/gunicorn -c /home/ubuntu/myapp/gunicorn.conf myapp.wsgi
end script
There is nothing wrong with the app itself, it runs fine. I can actually use it, despite it restarting constantly (several times a second). I only became aware of the problem when the log files exploded.
Previously, I did have the following clause:
pre-stop script
kill -15 `cat /tmp/gunicorn.pid`
end script
Which I am aware could have been causing the problem, but I've removed it and still have the problem.
Even removing both respawn lines and doing reload-configuration
still hasn't stopped it. What on earth is going on?