From 7822449f25d732f17b6be598c54369474c548777 Mon Sep 17 00:00:00 2001 From: Seena Fallah Date: Wed, 10 Jun 2020 23:52:44 +0430 Subject: [PATCH] Fix bug on debian logrotate scripts (#260) prerotate isn't working if there is no httpd-prerotate and it's no more needed and also postrotate can be kill -USR1 --- templates/logrotate/nginx.j2 | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/templates/logrotate/nginx.j2 b/templates/logrotate/nginx.j2 index b8b3220..78ab547 100644 --- a/templates/logrotate/nginx.j2 +++ b/templates/logrotate/nginx.j2 @@ -5,14 +5,11 @@ {% for option in nginx_logrotate_conf.options %} {{ option }} {% endfor %} - prerotate - if [ -d /etc/logrotate.d/httpd-prerotate ]; then \ - run-parts /etc/logrotate.d/httpd-prerotate; \ - fi \ - endscript postrotate {% if ansible_os_family == "Debian" %} - invoke-rc.d nginx rotate >/dev/null 2>&1 + if [ -f /var/run/nginx.pid ]; then + kill -USR1 `cat /var/run/nginx.pid` + fi {% else %} nginx -s reopen {% endif %}