Script to clean puppet dashboard

#!/bin/bash

# this script does cleanup on puppet dashboard
# - removes old entries
# - optimizes the database
# - clears the logs

dash=/usr/share/puppet-dashboard

renv="RAILS_ENV=production"

cd ${dash}

# prune the database of entries older than 15 days
`which rake` ${renv} reports:prune upto=15 unit=day

# optimize the database
`which rake` ${renv} db:raw:optimize

# clear the logs
`which rake` ${renv} log:clear

find /var/lib/puppet/reports/ -type f -mtime +45 -atime +45 -print0 | xargs -0 rm

Submitted by davea on Tue, 2013-08-06 15:23.