From 93858a4c34dd4007c72e915ed175bcdc24bbdadd Mon Sep 17 00:00:00 2001 From: Adam Spragg Date: Thu, 31 May 2018 23:25:50 +0100 Subject: First fully working config and content for the site --- daily.sh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 daily.sh (limited to 'daily.sh') diff --git a/daily.sh b/daily.sh new file mode 100755 index 0000000..2d15006 --- /dev/null +++ b/daily.sh @@ -0,0 +1,30 @@ +#! /bin/sh + +DOMAIN="spragg-ssl.co.uk" +SITEROOT="/srv/www/$DOMAIN" + +DATE=`/bin/date +%Y-%m-%d` +LOGFILE="$SITEROOT/log/updates.$DATE.log" +TSFMT="%b %d %H:%M:%S" + +AWYEAR=`/bin/date -d yesterday +%Y` +AWMON=`/bin/date -d yesterday +%m` + + +# Delete any logs older than 30 days +/usr/bin/find "$SITEROOT/log" -name "*.log" -mtime +30 -delete 2>&1 | /usr/bin/ts "$TSFMT find:" >>$LOGFILE + +# Run awstats +$SITEROOT/awstats/awstats -config="$DOMAIN" -update 2>&1 | /usr/bin/ts "$TSFMT awstats:" >>$LOGFILE + +# Remove any PII (e.g. IP addresses) from the awstats data +#AWDATA="$SITEROOT/awstats/data/awstats${AWMON}${AWYEAR}.txt" +#/bin/grep -E -v "^[[:digit:]]{1,3}\\.[[:digit:]]{1,3}\\.[[:digit:]]{1,3}\\.[[:digit:]]{1,3} [[:digit:]]" "$AWDATA" | /usr/bin/sponge "$AWDATA" + +#$SITEROOT/awstats/awstats_buildstaticpages.pl \ +/usr/share/awstats/tools/awstats_buildstaticpages.pl \ + -awstatsprog="$SITEROOT/awstats/awstats" \ + -config="$DOMAIN" -dir="$SITEROOT/awstats/html" \ + -year="$AWYEAR" -month="$AWMONTH" \ + 2>&1 | /usr/bin/ts "$TSFMT awstats_buildstaticpages.pl:" >>$LOGFILE + -- cgit v1.2.1