HOME


sh-3ll 1.0
DIR:/proc/self/root/home/interworx/contrib/
Upload File :
Current File : //proc/self/root/home/interworx/contrib/awclean.sh
#!/bin/bash
#:=============================================================================
#:    Title: awclean.sh
#:     Date: 2011-04-19
#:  Version: 0.2
#:   Author: Benjamin Nugent <bnugent@nexcess.net>
#:  Options: none
#:=============================================================================
#set -x # set -o xtrace  : print command traces before executing command
#set -u # set -o nounset : exits script if using unset variables
#set -e # set -o errexit : exits script if any statement returns non-true
progname=${0##*/}

## creates reference file for find
TMPFILE=$(mktemp)
MTIME_CUTOFF="2009-06-01"
touch --date=$MTIME_CUTOFF $TMPFILE

## pattern to filter out files from last day of month
## Jan 2000 - Jun 2009
regex="(000130|000228|000330|000429|000530|000629|000730|000830|000929|001030|001129|001230|010130|010228|010330|010429|010530|010629|010730|010830|010929|011030|011129|011230|020130|020228|020330|020429|020530|020629|020730|020830|020929|021030|021129|021230|030130|030228|030330|030429|030530|030629|030730|030830|030929|031030|031129|031230|040130|040228|040330|040429|040530|040629|040730|040830|040929|041030|041129|041230|050130|050228|050330|050429|050530|050629|050730|050830|050929|051030|051129|051230|060130|060228|060330|060429|060530|060629|060730|060830|060929|061030|061129|061230|070130|070228|070330|070429|070530|070629|070730|070830|070929|071030|071129|071230|080130|080228|080330|080429|080530|080629|080730|080830|080929|081030|081129|081230|090130|090228|090330|090429|090530)"

STATSDIR="/home/*/var/*/stats/awstats/"

## remove contents of $STATSDIRmonthly/ directory
find ${STATSDIR}monthly/ -type f | xargs rm 2>/dev/null

printf "Script completed run.\n"