diff -Nru nginx-1.4.6/debian/changelog nginx-1.4.6/debian/changelog --- nginx-1.4.6/debian/changelog 2015-02-09 12:25:06.000000000 -0500 +++ nginx-1.4.6/debian/changelog 2015-07-29 19:48:25.000000000 -0400 @@ -1,3 +1,10 @@ +nginx (1.4.6-1ubuntu3.3) trusty-proposed; urgency=medium + + * debian/nginx-common.nginx.init: Fix pidfile extraction, due to multiple + failure cases, using Debian's solution. (LP: #1314740) + + -- Thomas Ward Wed, 29 Jul 2015 19:43:04 -0400 + nginx (1.4.6-1ubuntu3.2) trusty-proposed; urgency=medium * d/modules/nginx-http-push: Apply upstream bugfix. (LP: #1216817) diff -Nru nginx-1.4.6/debian/nginx-common.nginx.init nginx-1.4.6/debian/nginx-common.nginx.init --- nginx-1.4.6/debian/nginx-common.nginx.init 2014-03-04 17:25:28.000000000 -0500 +++ nginx-1.4.6/debian/nginx-common.nginx.init 2015-07-29 19:46:36.000000000 -0400 @@ -25,7 +25,8 @@ . /lib/init/vars.sh . /lib/lsb/init-functions -PID=$(awk -F'[ \t;]+' '/[^#]pid/ {print $2}' /etc/nginx/nginx.conf) +# Try to extract nginx pidfile +PID=$(cat /etc/nginx/nginx.conf | grep -Ev '^\s*#' | awk 'BEGIN { RS="[;{}]" } { if ($1 == "pid") print $2 }' | head -n1) if [ -z "$PID" ] then PID=/run/nginx.pid