On Tue, 2011-05-17 at 10:43 +0200, Jan-Frode Myklebust wrote:
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
--------------------------------------------------------------
<shrug>
I'm not sure how it makes a hill of beans worth of difference.
It makes no network connections and performs nothing controversial.
-sv