system-config/modules/openstack_project/files/log_archive_maintenance.sh
Jeremy Stanley b1b421fa9d Don't remove lost+found from static.o.o.
Change-Id: I566a38da017447d13014739ba37ba42bca21d09c
2013-07-23 16:02:47 +00:00

21 lines
755 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 -not -name lost+found -empty -mtime +1 \
-execdir rmdir {} \; \) \
\)
find /srv/static/docs-draft/ -depth \
\( \
\( -type f -mtime +30 -name \*.gz -execdir rm \{\} \; \) \
-o \( -type d -not -name lost+found -empty -mtime +1 \
-execdir rmdir {} \; \) \
\)