add in script for daily awstats
This commit is contained in:
parent
acda0d3bd1
commit
a64ee2a336
2 changed files with 53 additions and 0 deletions
1
roles/web-data-analysis/files/run-daily-awstats.cron
Normal file
1
roles/web-data-analysis/files/run-daily-awstats.cron
Normal file
|
@ -0,0 +1 @@
|
|||
0 08 * * * root /usr/local/bin/run-daily-awstats.sh
|
52
roles/web-data-analysis/files/run-daily-awstats.sh
Normal file
52
roles/web-data-analysis/files/run-daily-awstats.sh
Normal file
|
@ -0,0 +1,52 @@
|
|||
#!/bin/bash
|
||||
|
||||
# This file is part of Fedora Project Infrastructure Ansible
|
||||
# Repository.
|
||||
#
|
||||
# Fedora Project Infrastructure Ansible Repository is free software:
|
||||
# you can redistribute it and/or modify it under the terms of the GNU
|
||||
# General Public License as published by the Free Software Foundation,
|
||||
# either version 3 of the License, or (at your option) any later
|
||||
# version.
|
||||
#
|
||||
# Fedora Project Infrastructure Ansible Repository is distributed in
|
||||
# the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
# details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Fedora Project Infrastructure Ansible Repository. If
|
||||
# not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# There is a multiday delay involved in processing the logs. It
|
||||
# may take up to 4 days to get the logs to the main-server. It may
|
||||
# take a day to combine all the logs onto combined-httpd. So we assume
|
||||
# we are 5 days behind.
|
||||
|
||||
let NUMDAYS=5
|
||||
|
||||
# This is the year/month/day for a N days ago.
|
||||
YEAR=$(/bin/date -d "-${NUMDAYS} days" +%Y)
|
||||
MONTH=$(/bin/date -d "-${NUMDAYS} days" +%m)
|
||||
DAY=$(/bin/date -d "-${NUMDAYS} days" +%d)
|
||||
|
||||
LOGDIR=/mnt/fedora_stats/combined-http/
|
||||
CONFDIR=/mnt/fedora_stats/awstats/conf
|
||||
OUTDIR=/var/www/html/awstats-reports
|
||||
|
||||
TREEDIR=${LOGDIR}/${YEAR}/${MONTH}/${DAY}
|
||||
|
||||
|
||||
AWSTATS=/usr/share/awstats/wwwroot/cgi-bin/awstats.pl
|
||||
HTMLDOC=/usr/bin/htmldoc
|
||||
|
||||
SITES="apps.fedoraproject.org codecs.fedoraproject.org communityblog.fedoraproject.org docs.fedoraproject.org download.fedoraproject.org fedoramagazine.org fedoraproject.org geoip.fedoraproject.org get.fedoraproject.org getfedora.org labs.fedoraproject.org mirrors.fedoraproject.org spins.fedoraproject.org start.fedoraproject.org"
|
||||
|
||||
|
||||
for SITE in ${SITES}; do
|
||||
perl /usr/share/awstats/wwwroot/cgi-bin/awstats.pl -config=${CONFDIR}/${SITE} -update -Logfile=${TREEDIR}/${SITE}-access.log
|
||||
mkdir -p ${OUTDIR}/${YEAR}
|
||||
perl /usr/share/awstats/wwwroot/cgi-bin/awstats_buildstaticpages.pl -awstatsprog=${AWSTATS} -config=${SITE} -month=all -year=${YEAR} -dir=${OUTDIR}/${YEAR} ;
|
||||
done
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue