Awstats Purging

It seems like by default, awstats html files for everyday are stored perpetually. Do these ever ‘expire’ and rotate off the system?

The are stored perpetually. They live in the /home/<user>/var/<domain>/stats/awstats directory if you’d like to purge them.

Chris

Is there a way to automatically purge the stats of 6 months and older? This because the size of the stats of the sites is becoming huge.

Well I created a bash script to do this manually:


/home/interworx/bin/listaccounts.pex | awk '{print "rm -f /home/" $1 "/var/" $2 "/stats/awstats/daily/awstats*.0707*.html"}' > remove_old_stats.sh

When executing remove_old_stats.sh, the stats that were created 6 months ago are deleted.
The thing is that I would like to do this automatic with a cronjob. The “0707” part is the same as the output of:


date --date='6 month ago' +%y%m

But I’m not really a bash expert so I don’t know how to combine this so that I can created a fully automated script that deletes all stats that are 6 months old automatically.

Maybe someone can help?