puppet: Merged puppet-report-cleanup from parameterize branch.

This commit is contained in:
Timo Makinen 2014-10-13 11:19:52 +03:00
parent 766f7d06a5
commit 3cf4363186
2 changed files with 35 additions and 15 deletions

View file

@ -1,6 +1,11 @@
#!/bin/sh
MAXAGE=<%= @puppet_report_maxage %>
if [ "`whoami`" = "root" ]; then
echo "$0: must not be run as root"
exit 1
fi
/usr/sbin/tmpwatch -m ${MAXAGE} /srv/puppet/reports
find /srv/puppet/reports/ -mindepth 2 -mmin +1440 -type f -name \*.yaml -exec gzip {} \;
find /srv/puppet/reports/ -xdev -mindepth 2 -type f -mtime +<%= @puppet_report_maxage %> \
-name '*.yaml.gz' -execdir rm -f -- {} \;
find /srv/puppet/reports/ -xdev -mindepth 2 -type f -mtime +1 \
-name '*.yaml' -execdir gzip -- {} \;