It took me a while to find out, but as of some recent-ish update, I can't stop Nginx on any of my Ubuntu 12.04 or Ubuntu 14.04 servers.
I run sudo service nginx stop, and I get nginx start/running, process 16178.
I try sudo service nginx stop again, and I get nginx start/running, process 16206.
Note how the process number changes.
In /var/log/syslog I can see why:
Jun 11 11:57:51 kernel: [2318556.994508] init: nginx main process ended, respawning.
Nginx is respawned every time I run sudo service nginx stop. It never comes to a full stop.
I tried updating Ubuntu, rebooted and I re-installed my servers on local test-images (I use Puppet). Nothing makes any difference. I also tried searching for bugs relating to this without avail.
Does anyone know how I can fix this problem? I'd like to be able to run sudo service nginx stop and have all nginx processes stopped as a result.
nginx? The packages fornginxin Ubuntu at least upto 14.04 use sysv init scripts, not Upstart init files. Therespawnoption is an Upstart thing, and neither Ubuntu's package fornginxnor the nginx team's PPA (https://launchpad.net/~nginx/+archive/ubuntu/stable) use Upstart. – muru Jul 31 '15 at 23:16