#!/bin/bash
#
# test_web
#
# Es werden Web-Dienste aus /etc/uls/test_web.d auf
# Verfuegbarkeit und Dauer der Antwort getestet.
#
#
WDIR="`dirname $0`"
#
D=""
C=/etc/uls/test_web.d
S=""
H=""
#
while getopts c:d:h:S op
 do
  case "$op" in
    d) D="-d $OPTARG";;
    c) C="$OPTARG";;
    h) H="-h $OPTARG";;
    S) S="-S";;
    *) echo "usage: $0 [-d storepath] [-c confpath]"
       exit 1;;
  esac
done
shift $(( $OPTIND - 1 ))
#
#
if [[ $# -lt 2 ]]
 then
  DT="`date '+%F %T%:z'`"
else
  DT="$1 $2"
fi
#
if [[ -d "$C" ]]
 then
  for f in "$C"/*.conf
   do
    if [[ -f "$f" ]]
     then
      "$WDIR"/test_web_single $H $D $S "$f" $DT &
    fi
  done
  sleep 20
fi
