compress old puppet reports

Jan-Frode Myklebust janfrode at tanso.net
Tue May 17 08:43:47 UTC 2011


Shouldn't this also be running as puppet, not root ?

--------------------------------------------------------------
diff --git a/modules/puppet/files/puppet-report-clean.sh b/modules/puppet/files
index d4af330..8aff168 100755
--- a/modules/puppet/files/puppet-report-clean.sh
+++ b/modules/puppet/files/puppet-report-clean.sh
@@ -1,12 +1,13 @@
 #!/bin/bash
 
 # clean up all but the last 1 month of puppet reports
-/usr/sbin/tmpwatch --mtime 720 /var/lib/puppet/reports/
+/sbin/runuser -s /bin/sh - puppet -c "/usr/sbin/tmpwatch --mtime 720 /var/lib/
 
 # compress all the .yaml files per host dir, except for the latest 24 hours wo
 # since they are txt files and compress really well
 
 for host in `echo /var/lib/puppet/reports/*`
 do 
- /bin/ls -1 $host/*.yaml | head --lines=-48 | xargs --no-run-if-empty xz -9
+ /bin/ls -1 $host/*.yaml | head --lines=-48 | \
+       /sbin/runuser -s /bin/sh - puppet -c "xargs --no-run-if-empty xz -9"
 done
--------------------------------------------------------------


  -jf


More information about the infrastructure mailing list