[packweb-apache] Do gzip logs after web server reload instead of before to address 'file size changed while zipping' error.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
William Hirigoyen (Evolix) 2022-07-19 15:01:20 +02:00
parent 0b41efd188
commit 2e54944a24
1 changed files with 16 additions and 1 deletions

View File

@ -5,7 +5,6 @@ HOMEPREFIX="/home"
rotate () {
mv $1 $1.$DATE
gzip $1.$DATE
touch $1
chown $2 $1
chmod g+r $1
@ -36,5 +35,21 @@ fi;
test -x /usr/sbin/nginx && invoke-rc.d nginx rotate >/dev/null 2>&1
# Zipping is done after web serveur reload, so that the file descriptor is released.
# Else, an error is raised (gzip file size changed while zipping)
# and logs written buring the zipping process might be lost.
for log in access.log access-*.log error.log; 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 delayed_job.log development.log test.log; do
for i in `ls -1 -d $HOMEPREFIX/*/www/{,current/}log/$log 2>/dev/null | grep -v \.bak\.`; do
gzip $i
done
done
# we want exit 0
true