wok diff awstats/stuff/update @ rev 18713

Translations for Science category (thanks Aleksej)
author Lucas Levrel <llevrel@yahoo.fr>
date Wed Dec 16 20:44:08 2015 +0100 (2015-12-16)
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/awstats/stuff/update	Wed Dec 16 20:44:08 2015 +0100
     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