--- badi/public_scripts/awstats_update_all/awstats_update_all 2010/07/31 11:54:46 1.2 +++ badi/public_scripts/awstats_update_all/awstats_update_all 2010/08/01 19:33:20 1.3 @@ -1,32 +1,44 @@ #!/bin/sh - # Update all awstats sites there is a config file for +# This script runs awstats -update for all sites a config file +# exists in the awstats config dir. It runs the update process in parallel +# for several sites at once. Give the command line argument "-q" to suppress +# all but error output. + +# (c) 2010 under GPL v2 by Adrian Zaugg. AWSTATS_BIN="/usr/lib/cgi-bin/awstats.pl" CONF_DIR="/etc/awstats" + +# file to exclude CONF_TEMPLATE="awstats.default" + +# normal awstats config files have this extension CONF_EXT="conf" + +# Run with this priority NICENESS=16 + +# maximum awstats update processes to run at once MAX_PROCESSES=8 + # Wait that many seconds when MAX_PROCESSES are COUNT_PROC # to retry starting new update processes RETRY=2 - # ----don't edit below this line----- # default to babbly, -q suppress output SPEAK=true - if [ "$1" = "-q" ]; then SPEAK=false fi function count_proc() { - # count how many instances are already running + # count how many instances are already COUNT_PROC COUNT_PROC=$(ps -o command -u "$(id -u)" | egrep -cwe '^(/bin/sh|/usr/bin/perl)* *'"$AWSTATS_BIN") }