Sorry guys I think this is going the wrong way. I know the service state recognition method from ansible very well because i recently patched it...
Ansible running on ubuntu tries to get the running state form upstart if it's an upstart script. (Not the case here) On the next step it tries to get the Service state by return Code. Next Fallback is the output of the script. Nginx returns an exit 4 through LSB status_of_proc function that means the status is unknwon. Which is correct in this case because of one little detail. The LSB status_of_proc get's called like this: status_of_proc -p /var/run/$NAME.pid "$DAEMON" nginx && exit 0 || exit $? Which to my knowledge advices status_of_proc to explicitly check the status by the PID file. Since the PID File is cleaned up in the stopping routine, an exit 4 is the correct answer of the LSB function. It simply can't recognize the state by the PID File because it's not there. If you use the LSB function like this: status_of_proc "$DAEMON" nginx && exit 0 || exit $? The return code of a stopped nginx process will return 3 which is the correct value for a stopped process according to LSB documentation: http://refspecs.linuxbase.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1023389 Title: "service nginx status" is confusing when nginx is not running To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/nginx/+bug/1023389/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs