wok diff awstats/stuff/update @ rev 20317
the current version (4.4) of the banking app is 7 years old :-( new version: 5.1.8
author | Erkan Yilmaz <erkan@slitaz.org> |
---|---|
date | Sun May 20 11:05:25 2018 +0000 (2018-05-20) |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/awstats/stuff/update Sun May 20 11:05:25 2018 +0000 1.3 @@ -0,0 +1,44 @@ 1.4 +#!/bin/sh 1.5 + 1.6 +list_vhosts() 1.7 +{ 1.8 +[ -d /etc/apache ] && cat /etc/apache/conf.d/* | awk ' \ 1.9 +/ServerName/ { name=$2 } 1.10 +/CustomLog/ { file=$2 } 1.11 +{ 1.12 + if ( name != "" && file != "" ) { 1.13 + printf "%s %s\n",name,file 1.14 + name="" 1.15 + file="" 1.16 + } 1.17 +} 1.18 +' | sed '/localhost/d;/\//!d' 1.19 +[ -d /etc/lighttpd ] && grep -v '^ *#' /etc/lighttpd/vhosts.conf | awk ' \ 1.20 +/HTTP."host"/ { name=$3 ; file="" } 1.21 +/accesslog.filename/ { file=$3 } 1.22 +{ 1.23 + if ( name != "" && file != "" ) { 1.24 + printf "%s %s\n",name,file 1.25 + name="" 1.26 + } 1.27 +} 1.28 +' | sed 's/\$//;s/\^//;s/\\//g;s/"//g;/(/d' 1.29 +} 1.30 + 1.31 +cd /etc/awstats 1.32 + 1.33 +list_vhosts | while read name logfile; do 1.34 + [ -s $logfile ] || continue 1.35 + [ -s /etc/awstats/awstats.$name.conf ] && continue 1.36 + mkdir -p /var/lib/awstats/$name 1.37 + sed -e "s|LogFile=.*|LogFile=\"$logfile\"|" \ 1.38 + -e "s|SiteDomain=.*|SiteDomain=\"$name\"|" \ 1.39 + -e "s|DirData=.*|DirData=\"/var/lib/awstats/$name\"|" \ 1.40 + -e "s|LogoLink=.*|LogoLink=\"http://$name/\"|" \ 1.41 + < /etc/awstats/awstats.model.conf > /etc/awstats/awstats.$name.conf 1.42 +done 1.43 + 1.44 +for i in $(grep -l '^DirData="/var/lib/awstats' *.conf); do 1.45 + /var/www/cgi-bin/awstats.pl \ 1.46 + config=$(echo $i | sed 's/awstats\.\(.*\)\.conf/\1/') -update 1.47 +done