system-config/modules/openstack_project/files/log_archive_maintenance.sh
Jeremy Stanley d241c0575c Don't try to compress patterns ignored by gzip.
* modules/openstack_project/files/log_archive_maintenance.sh:
According to the gzip manpage, there are a variety of filename
endings it will consider to indicate a file is already compressed
and will then refuse to compress. Some tempfiles get
randomly-generated names which match these endings, causing the
compression cron job to emit errors. Instead we make the script skip
over them.

Change-Id: Ib78a19362eaa54c43f44a9e6bd0c265dddee92be
Reviewed-on: https://review.openstack.org/34419
Reviewed-by: Clark Boylan <clark.boylan@gmail.com>
Approved: James E. Blair <corvus@inaugust.com>
Reviewed-by: James E. Blair <corvus@inaugust.com>
Tested-by: Jenkins
2013-07-02 16:52:15 +00:00

19 lines
687 B
Bash

#!/bin/sh
sleep $((RANDOM%600)) && \
flock -n /var/run/gziplogs.lock \
find /srv/static/logs/ -depth \
\( \
\( -type f -not -name robots.txt \
-not -wholename /srv/static/logs/help/\* \
-not -name \*\[.-\]gz -not -name \*\[._-\]\[zZ\] \
\( -name \*.txt -or -name \*.html -or -name tmp\* \) \
-exec gzip \{\} \; \) \
-o \( -type f -mtime +183 -name \*.gz -execdir rm \{\} \; \) \
-o \( -type d -empty -mtime +1 -execdir rmdir {} \; \) \
\)
find /srv/static/docs-draft/ -depth \
\( \
\( -type f -mtime +30 -name \*.gz -execdir rm \{\} \; \) \
-o \( -type d -empty -mtime +1 -execdir rmdir {} \; \) \
\)