Merge "Remove old non-gz files in log archive maintenance"

This commit is contained in:
Jenkins 2014-05-22 23:14:28 +00:00 committed by Gerrit Code Review
commit 9193bbb583

View File

@ -1,20 +1,13 @@
#!/bin/sh
sleep $((RANDOM%600)) && \
flock -n /var/run/gziplogs.lock \
find -O3 /srv/static/logs/ -depth \
\( \
\( -type f -mmin +10 -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 +120 -name \*.gz -execdir rm \{\} \; \) \
-o \( -type d -not -name lost+found -empty -mtime +1 \
-execdir rmdir {} \; \) \
\)
find -O3 /srv/static/docs-draft/ -depth \
\( \
\( -type f -mtime +21 -name \*.gz -execdir rm \{\} \; \) \
-o \( -type d -not -name lost+found -empty -mtime +1 \
-execdir rmdir {} \; \) \
\)
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 \*\[.-\]gz -not -name \*\[._-\]\[zZ\] \
\( -name \*.txt -or -name \*.html -or -name tmp\* \) \
-exec gzip \{\} \; \) \
-o \( -type f -mtime +120 -execdir rm \{\} \; \) \
-o \( -type d -not -empty -mtime +1 -execdir rmdir {} \; \) \)
find -O3 /srv/static/docs-draft/ -depth -not -name lost+found \( \
\( -type f -mtime +21 -name \*.gz -execdir rm \{\} \; \) \
-o \( -type d -empty -mtime +1 -execdir rmdir {} \; \) \)