wok-current view awstats/stuff/update @ rev 11359

Up: polkit to 0.103.
author Christopher Rogers <slaxemulator@gmail.com>
date Tue Dec 06 18:46:25 2011 +0000 (2011-12-06)
parents
children
line source
1 #!/bin/sh
3 list_vhosts()
4 {
5 [ -d /etc/apache ] && cat /etc/apache/conf.d/* | awk ' \
6 /ServerName/ { name=$2 }
7 /CustomLog/ { file=$2 }
8 {
9 if ( name != "" && file != "" ) {
10 printf "%s %s\n",name,file
11 name=""
12 file=""
13 }
14 }
15 ' | sed '/localhost/d;/\//!d'
16 [ -d /etc/lighttpd ] && grep -v '^ *#' /etc/lighttpd/vhosts.conf | awk ' \
17 /HTTP."host"/ { name=$3 ; file="" }
18 /accesslog.filename/ { file=$3 }
19 {
20 if ( name != "" && file != "" ) {
21 printf "%s %s\n",name,file
22 name=""
23 }
24 }
25 ' | sed 's/\$//;s/\^//;s/\\//g;s/"//g;/(/d'
26 }
28 cd /etc/awstats
30 list_vhosts | while read name logfile; do
31 [ -s $logfile ] || continue
32 [ -s /etc/awstats/awstats.$name.conf ] && continue
33 mkdir -p /var/lib/awstats/$name
34 sed -e "s|LogFile=.*|LogFile=\"$logfile\"|" \
35 -e "s|SiteDomain=.*|SiteDomain=\"$name\"|" \
36 -e "s|DirData=.*|DirData=\"/var/lib/awstats/$name\"|" \
37 -e "s|LogoLink=.*|LogoLink=\"http://$name/\"|" \
38 < /etc/awstats/awstats.model.conf > /etc/awstats/awstats.$name.conf
39 done
41 for i in $(grep -l '^DirData="/var/lib/awstats' *.conf); do
42 /var/www/cgi-bin/awstats.pl \
43 config=$(echo $i | sed 's/awstats\.\(.*\)\.conf/\1/') -update
44 done