userlogrotate: fix bug introduced in commit 2e54944a24 (rotated files were not zipped)
All checks were successful
gitea/ansible-roles/pipeline/head This commit looks good

This commit is contained in:
William Hirigoyen 2023-03-01 17:22:36 +01:00
parent d9c5563fd6
commit cc7c2a7d4e
3 changed files with 21 additions and 3 deletions

View file

@ -49,6 +49,7 @@ The **patch** part changes is incremented if multiple releases happen the same m
* postfix (packmail only): disable `concurrency_failed_cohort_limit` for destination smtp-amavis to prevent the suspension of this destination when Amavis fails to answer. Indeed, we configure the suspension delay quite long in `minimal_backoff_time` (2h) and `maximal_backoff_time` (6h) to reduce the risk of ban from external SMTPs. * postfix (packmail only): disable `concurrency_failed_cohort_limit` for destination smtp-amavis to prevent the suspension of this destination when Amavis fails to answer. Indeed, we configure the suspension delay quite long in `minimal_backoff_time` (2h) and `maximal_backoff_time` (6h) to reduce the risk of ban from external SMTPs.
* php: install using sury repositories on bullseye * php: install using sury repositories on bullseye
* postfix: remove unused "aliases_scope=sub" from virtual_aliases.cf (it generated warnings) * postfix: remove unused "aliases_scope=sub" from virtual_aliases.cf (it generated warnings)
* userlogrotate: fix bug introduced in commit 2e54944a246 (rotated files were not zipped)
### Removed ### Removed

View file

@ -39,13 +39,13 @@ test -x /usr/sbin/nginx && invoke-rc.d nginx rotate >/dev/null 2>&1
# Else, an error is raised (gzip file size changed while zipping) # Else, an error is raised (gzip file size changed while zipping)
# and logs written during the zipping process might be lost. # and logs written during the zipping process might be lost.
for log in access.log access-*.log error.log; do for log in access.log*[!\.gz] access-*.log*[!\.gz] error.log*[!\.gz]; do
for i in `ls -1 -d $HOMEPREFIX/*/log/$log 2>/dev/null | grep -v \.bak\.`; do for i in `ls -1 -d $HOMEPREFIX/*/log/$log 2>/dev/null | grep -v \.bak\.`; do
gzip $i gzip $i
done done
done done
for log in production.log delayed_job.log development.log test.log; do for log in production.log*[!\.gz] delayed_job.log*[!\.gz] development.log*[!\.gz] test.log*[!\.gz]; do
for i in `ls -1 -d $HOMEPREFIX/*/www/{,current/}log/$log 2>/dev/null | grep -v \.bak\.`; do for i in `ls -1 -d $HOMEPREFIX/*/www/{,current/}log/$log 2>/dev/null | grep -v \.bak\.`; do
gzip $i gzip $i
done done

View file

@ -5,7 +5,6 @@ HOMEPREFIX="/home"
rotate () { rotate () {
mv $1 $1.$DATE mv $1 $1.$DATE
gzip $1.$DATE
touch $1 touch $1
chown $2 $1 chown $2 $1
chmod g+r $1 chmod g+r $1
@ -36,3 +35,21 @@ for log in production.log delayed_job.log development.log test.log; do
done done
apache2ctl restart > /dev/null apache2ctl restart > /dev/null
# Zipping is done after web server reload, so that the file descriptor is released.
# Else, an error is raised (gzip file size changed while zipping)
# and logs written during the zipping process might be lost.
for log in access.log*[!\.gz] access-*.log*[!\.gz] error.log*[!\.gz]; do
for i in `ls -1 -d $HOMEPREFIX/*/log/$log 2>/dev/null | grep -v \.bak\.`; do
gzip $i
done
done
for log in production.log*[!\.gz] delayed_job.log*[!\.gz] development.log*[!\.gz] test.log*[!\.gz]; do
for i in `ls -1 -d $HOMEPREFIX/*/www/{,current/}log/$log 2>/dev/null | grep -v \.bak\.`; do
gzip $i
done
done