awstats 統計ページHTML版作成 ----------------------------------- [root@falcon21 ~]# vi awstatsreport.sh #!/bin/bash site=$1 dir=$2 reportbuild() { # AWStatsデータベース更新中断時ロックファイル残存対処(ここから) if [ -f /tmp/awstats.$site.lock ]; then ps -p `cat /tmp/awstats.$site.lock |awk '{print $6}'` if [ $? -ne 0 ]; then echo /tmp/awstats.$site.lock removed >&2 rm -f /tmp/awstats.$site.lock fi fi # AWStatsデータベース更新中断時ロックファイル残存対処(ここまで) `rpm -ql awstats|grep "awstats_buildstaticpages\.pl"` \ -awstatsprog="`rpm -ql awstats|grep "awstats\.pl"`"\ -config=$site -update -lang=jp -dir=$dir \ -year=$YEAR -month=$MONTH -builddate=$YEAR$MONTH # 個別ページリンク切れ対処(ここから) sed -i "s/href=\"${site}/href=\"awstats.${site}/g" \ $dir/awstats.$site.$YEAR$MONTH.html # 個別ページリンク切れ対処(ここまで) if [ "$YEAR$MONTH" = $(date +%Y%m) ]; then mv $dir/awstats.$site.$YEAR$MONTH.html $dir/index.html else mv $dir/awstats.$site.$YEAR$MONTH.html $dir/$YEAR$MONTH.html fi } ls $dir/* > /dev/null 2>&1 if [ $? -eq 0 ]; then YEAR=`date --date '1 days ago' +%Y` MONTH=`date --date '1 days ago' +%m` reportbuild else DirData=`grep ^DirData /etc/awstats/awstats.model.conf|awk -F= '{print $2}'|tr -d \"` for log in `ls $DirData/awstats*.$site.txt` do YEAR=`echo $log|cut -d / -f 5|cut -d . -f 1|sed -e 's/awstats..\([^ ]*\)/\1/p' -e d` MONTH=`echo $log|cut -d / -f 5|cut -d . -f 1|sed -e 's/awstats\([^ ]*\)..../\1/p' -e d` reportbuild done fi ------------------------------------------- [root@falcon21 ~]# chmod 700 awstatsreport.sh アクセス統計ページHTML版作成スクリプト実行[root@falcon21 ~]# mkdir /var/www/awstatsreport [root@falcon21 ~]# chmod -R 777 /var/www/awstatsreport [root@falcon21 ~]# vi /etc/httpd/conf.d/awstatsreport.conf Alias /awstatsreport "/var/www/awstatsreport" <Location "/awstatsreport"> Require all denied Require ip 127.0.0.1 Require ip 192.168.10.0/24 </Location> [root@falcon21 ~]# ./awstatsreport.sh falcon21.space /var/www/awstatsreport Build downloads page: "/usr/share/awstats/wwwroot/cgi-bin/awstats.pl" -config=falcon21.space -staticlinks=awstats.falcon21.space.201912 -lang=jp -month=12 -year=2019 -output=downloads Build refererse page: "/usr/share/awstats/wwwroot/cgi-bin/awstats.pl" -config=falcon21.space -staticlinks=awstats.falcon21.space.201912 -lang=jp -month=12 -year=2019 -output=refererse Build refererpages page: "/usr/share/awstats/wwwroot/cgi-bin/awstats.pl" -config=falcon21.space -staticlinks=awstats.falcon21.space.201912 -lang=jp -month=12 -year=2019 -output=refererpages Build keyphrases page: "/usr/share/awstats/wwwroot/cgi-bin/awstats.pl" -config=falcon21.space -staticlinks=awstats.falcon21.space.201912 -lang=jp -month=12 -year=2019 -output=keyphrases Build keywords page: "/usr/share/awstats/wwwroot/cgi-bin/awstats.pl" -config=falcon21.space -staticlinks=awstats.falcon21.space.201912 -lang=jp -month=12 -year=2019 -output=keywords Build errors404 page: "/usr/share/awstats/wwwroot/cgi-bin/awstats.pl" -config=falcon21.space -staticlinks=awstats.falcon21.space.201912 -lang=jp -month=12 -year=2019 -output=errors404 21 files built. Main HTML page is 'awstats.falcon21.space.201912.html'. https://falcon21.space/awstatsreport/ 確認 |
投票数:13
平均点:10.00