Remove old non-gz files in log archive maintenance
* modules/openstack_project/files/log_archive_maintenance.sh: Start matching for removal on any files in the logs tree besides those we explicitly don't compress. Also do it via a refactor to allow for improved optimization and avoid unnecessary redundancy. Change-Id: I5ff6defb4d403f3017ab098c2ac1df3777662933
This commit is contained in:
parent
f2a9b0b442
commit
7e480a1ed1
@ -1,20 +1,13 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
sleep $((RANDOM%600)) && \
|
sleep $((RANDOM%600)) && \
|
||||||
flock -n /var/run/gziplogs.lock \
|
flock -n /var/run/gziplogs.lock \
|
||||||
find -O3 /srv/static/logs/ -depth \
|
find -O3 /srv/static/logs/ -depth -not -name robots.txt -not -name lost+found \
|
||||||
\( \
|
-not -wholename /srv/static/logs/help/\* \( \
|
||||||
\( -type f -mmin +10 -not -name robots.txt \
|
\( -type f -mmin +10 -not -name \*\[.-\]gz -not -name \*\[._-\]\[zZ\] \
|
||||||
-not -wholename /srv/static/logs/help/\* \
|
|
||||||
-not -name \*\[.-\]gz -not -name \*\[._-\]\[zZ\] \
|
|
||||||
\( -name \*.txt -or -name \*.html -or -name tmp\* \) \
|
\( -name \*.txt -or -name \*.html -or -name tmp\* \) \
|
||||||
-exec gzip \{\} \; \) \
|
-exec gzip \{\} \; \) \
|
||||||
-o \( -type f -mtime +120 -name \*.gz -execdir rm \{\} \; \) \
|
-o \( -type f -mtime +120 -execdir rm \{\} \; \) \
|
||||||
-o \( -type d -not -name lost+found -empty -mtime +1 \
|
-o \( -type d -not -empty -mtime +1 -execdir rmdir {} \; \) \)
|
||||||
-execdir rmdir {} \; \) \
|
find -O3 /srv/static/docs-draft/ -depth -not -name lost+found \( \
|
||||||
\)
|
|
||||||
find -O3 /srv/static/docs-draft/ -depth \
|
|
||||||
\( \
|
|
||||||
\( -type f -mtime +21 -name \*.gz -execdir rm \{\} \; \) \
|
\( -type f -mtime +21 -name \*.gz -execdir rm \{\} \; \) \
|
||||||
-o \( -type d -not -name lost+found -empty -mtime +1 \
|
-o \( -type d -empty -mtime +1 -execdir rmdir {} \; \) \)
|
||||||
-execdir rmdir {} \; \) \
|
|
||||||
\)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user