Comment 7 for bug 1450770

Revision history for this message
Andrew Grasso (andrew-grasso) wrote :

I'm having the same issue on Ubuntu 12.04.5 running Nginx 1.8.0-1+precise1

I believe the issue is caused by by the change in Nginx 1.8.0-1+precise from SystemV init.d/ control to Upstart. The /etc/init.d/nginx script was changed to reflect this, but the /etc/logrotate.d/nginx script was not. The logrotate script still references the now removed "rotate" function in /etc/init.d/nginx.

@Ivan- "nginx -s reload" works because you are using the nginx binary directly to signal the reopen. "/etc/init.d/nginx rotate" does not work, because the "rotate" function was removed from the /etc/init.d/nginx script when switching to upstart.

I think the version of the init script that Michael Lustfield's references would resolve the issue, but it it doesn't seem in line with the direction of moving to Upstart. I think a better fix would be to modify the logrotate config deployed with this package to signal nginx to re-open the log files without depending on the init.d script at all.

--- nginx 2015-06-22 18:18:46.622051252 +0000
+++ nginx.new 2015-06-22 18:22:36.800340062 +0000
@@ -13,6 +13,6 @@
                fi \
        endscript
        postrotate
- invoke-rc.d nginx rotate >/dev/null 2>&1
+ [ -f /var/run/nginx.pid ] && kill -USR1 `cat /var/run/nginx.pid`
        endscript
 }

Like was done here:
https://launchpadlibrarian.net/209458833/nginx_1.4.6-1ubuntu3_1.8.0-1-ppa7.diff.gz