#!/bin/sh BASE_STAT_DIR=/users/httpd/html/krachtrand LOG_DIRS="internet patchruimte1 patchruimte2 patchruimte3 pz-loon servers" process_log() { if [ ! -d "$STAT_OUT_DIR"/totaal ];then echo "Creating totaal directory for "`basename $MRTG_LOG_FILE`"" mkdir "$STAT_OUT_DIR"/totaal fi if [ -f "$STAT_OUT_DIR"/totaal/"`basename $MRTG_LOG_FILE`".`date +%Y%m`.html ]; then #echo "Removing "`basename $MRTG_LOG_FILE`".`date +%Y%m`.html" rm "$STAT_OUT_DIR"/totaal/"`basename $MRTG_LOG_FILE`".`date +%Y%m`.html fi #echo "Creating totals for `basename $MRTG_LOG_FILE`" perl /usr/local/mrtg/calc.pl "$MRTG_LOG_FILE" `date +%m`-"01"-`date +%Y`-"00:00" \ `date +%m`-`date +%d`-`date +%Y`-`date +%H`:00 >> "$STAT_OUT_DIR"/totaal/"`basename $MRTG_LOG_FILE`".`date +%Y%m`.html } for LOG_DIR in $LOG_DIRS;do STAT_OUT_DIR="$BASE_STAT_DIR"/"$LOG_DIR" for MRTG_LOG_FILE in `find "$STAT_OUT_DIR" -name "*.log"`;do process_log done done