wok-current annotate awstats/stuff/update @ rev 19437

compiz-ccsm, xvkbd: check depends, tried to fix startup with some locales
author Xander Ziiryanoff <psychomaniak@xakep.ru>
date Sun Oct 09 18:56:56 2016 +0300 (2016-10-09)
parents
children
rev   line source
pascal@5959 1 #!/bin/sh
pascal@5959 2
pascal@5959 3 list_vhosts()
pascal@5959 4 {
pascal@5959 5 [ -d /etc/apache ] && cat /etc/apache/conf.d/* | awk ' \
pascal@5959 6 /ServerName/ { name=$2 }
pascal@5959 7 /CustomLog/ { file=$2 }
pascal@5959 8 {
pascal@5959 9 if ( name != "" && file != "" ) {
pascal@5959 10 printf "%s %s\n",name,file
pascal@5959 11 name=""
pascal@5959 12 file=""
pascal@5959 13 }
pascal@5959 14 }
pascal@5959 15 ' | sed '/localhost/d;/\//!d'
pascal@5959 16 [ -d /etc/lighttpd ] && grep -v '^ *#' /etc/lighttpd/vhosts.conf | awk ' \
pascal@5959 17 /HTTP."host"/ { name=$3 ; file="" }
pascal@5959 18 /accesslog.filename/ { file=$3 }
pascal@5959 19 {
pascal@5959 20 if ( name != "" && file != "" ) {
pascal@5959 21 printf "%s %s\n",name,file
pascal@5959 22 name=""
pascal@5959 23 }
pascal@5959 24 }
pascal@5959 25 ' | sed 's/\$//;s/\^//;s/\\//g;s/"//g;/(/d'
pascal@5959 26 }
pascal@5959 27
pascal@5959 28 cd /etc/awstats
pascal@5959 29
pascal@5959 30 list_vhosts | while read name logfile; do
pascal@5959 31 [ -s $logfile ] || continue
pascal@5959 32 [ -s /etc/awstats/awstats.$name.conf ] && continue
pascal@5959 33 mkdir -p /var/lib/awstats/$name
pascal@5959 34 sed -e "s|LogFile=.*|LogFile=\"$logfile\"|" \
pascal@5959 35 -e "s|SiteDomain=.*|SiteDomain=\"$name\"|" \
pascal@5959 36 -e "s|DirData=.*|DirData=\"/var/lib/awstats/$name\"|" \
pascal@5959 37 -e "s|LogoLink=.*|LogoLink=\"http://$name/\"|" \
pascal@5959 38 < /etc/awstats/awstats.model.conf > /etc/awstats/awstats.$name.conf
pascal@5959 39 done
pascal@5959 40
pascal@5959 41 for i in $(grep -l '^DirData="/var/lib/awstats' *.conf); do
pascal@5959 42 /var/www/cgi-bin/awstats.pl \
pascal@5959 43 config=$(echo $i | sed 's/awstats\.\(.*\)\.conf/\1/') -update
pascal@5959 44 done