From d05a9558f875218edb8769d74941769893a22c8d Mon Sep 17 00:00:00 2001 From: Pavel Raiskup Date: Fri, 3 Dec 2021 14:55:08 +0100 Subject: [PATCH] copr-be: fix logrotate Let's not reload-and-restart lighttpd (two actions for two scripts), and use the sharedscripts option. While on it, this reverts an old hack 4c4b63516da9128342e870524 that might not be needed nowadays. Fixes: https://pagure.io/copr/copr/issue/2001 Relates: https://pagure.io/fedora-infrastructure/issue/10391 --- .../backend/templates/logrotate/lighttpd.j2 | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/roles/copr/backend/templates/logrotate/lighttpd.j2 b/roles/copr/backend/templates/logrotate/lighttpd.j2 index 4de2098d5e..11088c8c8e 100644 --- a/roles/copr/backend/templates/logrotate/lighttpd.j2 +++ b/roles/copr/backend/templates/logrotate/lighttpd.j2 @@ -1,9 +1,15 @@ -/var/log/lighttpd/access.log { +# We don't want to reload lighttpd twice (for each log file), so we use +# the sharedscripts option. This means that hitcounter is run only once too +# (which is good). In (likely impossible) situations when access.log is empty +# and error.log not, we would call hitcounter too on an empty file. + +/var/log/lighttpd/*.log { rotate 5 daily missingok notifempty compress + sharedscripts prerotate {% if devel %} /usr/bin/copr_log_hitcounter.py /var/log/lighttpd/access.log --ignore-subnets 172.25.144.0/20 209.132.184.33/24 &>>/var/log/copr-backend/hitcounter-logrotate.log || : @@ -15,13 +21,3 @@ /usr/bin/killall -HUP lighttpd &>/dev/null || : endscript } - -/var/log/lighttpd/error.log { - rotate 5 - missingok - notifempty - compress - postrotate - systemctl restart lighttpd.service &>/dev/null || : - endscript -}