Great solution. Simple, effective. Thanks.

On Thursday, 21 July 2011 14:50:32 UTC+1, vagn wrote:
>
> On 07/21/2011 08:52 AM, vagn scott wrote:
> > Thinking about this some more, if you need the reports for dashboard 
> > to work,
> > then any cleanup script should  leave the latest report from any server,
> > so that, even if the server has not checked in for a while it won't 
> > disappear.
> >
> > Thanks for the question.  Clearly I need to revisit this.
> >
>
> So, here is a script that ought to do the job.  Not heavily tested yet.
> Please let me know if you have problems with it. --vagn
>
> #! /bin/sh
> # puppet-reports-stalker
> # vagn scott, 21-jul-2011
>
> days="+7"       # more than 7 days old
>
> for d in `find /var/lib/puppet/reports -mindepth 1 -maxdepth 1 -type d`
> do
>          find $d -type f -name \*.yaml -mtime $days |
>          sort -r |
>          tail -n +2 |
>          xargs -n50 /bin/rm -f
> done
>
> exit 0
>
>
> And the updated class.
>
> class puppet::clean_reports {
>
>          file { '/usr/local/bin/puppet-reports-stalker':
>                  source => 
>  'puppet:///modules/puppet/puppet-reports-stalker',
>                  before =>  Cron[ 'puppet clean reports' ],
>                  mode   =>  755,
>                  owner  =>  root,
>                  group  =>  root,
>          }
>
>          cron { 'puppet clean reports':
>            command =>  '/usr/local/bin/puppet-reports-stalker',
>            user =>  root,
>            hour =>  21,
>            minute =>  22,
>            weekday =>  0,
>          }
> }
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to