system-config/modules/openstack_project/files/log_archive_maintenance.sh
James E. Blair 86830dc5ad Reduce logs and docs-draft retention
Logs are now 4 months instead of 6, docs-draft 3 weeks instead of 4.

Both have unsustainable upward trajectories.

Change-Id: If8ae334c9b48bdacc79b71015fbf386c0f3613f6
2014-04-16 07:10:18 -07:00

21 lines
773 B
Bash

#!/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 {} \; \) \
\)