Don't compress very, very recent log files

* modules/openstack_project/files/log_archive_maintenance.sh: On
occasion the compressor will be engaged on a file which is still
being written to the log archive, resulting in a compressed but
truncated copy along with the original it lacked the write lock to
unlink. Then on a subsequent pass, this file will be skipped because
the destination filename already exists. Instead, don't compress a
file unless its last modified time is more than 10 minutes in the
past.

Change-Id: Ife874784babd41aa45b4183f4f0a5a5730cf5a23
This commit is contained in:
Jeremy Stanley 2013-08-12 21:23:40 +00:00
parent a3db4339a9
commit 968e77129b

View File

@ -3,7 +3,7 @@ sleep $((RANDOM%600)) && \
flock -n /var/run/gziplogs.lock \ flock -n /var/run/gziplogs.lock \
find /srv/static/logs/ -depth \ find /srv/static/logs/ -depth \
\( \ \( \
\( -type f -not -name robots.txt \ \( -type f -mmin +10 -not -name robots.txt \
-not -wholename /srv/static/logs/help/\* \ -not -wholename /srv/static/logs/help/\* \
-not -name \*\[.-\]gz -not -name \*\[._-\]\[zZ\] \ -not -name \*\[.-\]gz -not -name \*\[._-\]\[zZ\] \
\( -name \*.txt -or -name \*.html -or -name tmp\* \) \ \( -name \*.txt -or -name \*.html -or -name tmp\* \) \