#!/bin/ksh
#
# get_server_values
#
# Liest Werter aus dem ULS aus. Dazu muss die abfragende IP-Adresse fr den Server
# freigegeben werden.
#
# Aufruf:
#
# get_server_values server section teststep details einheit [<datcode [<-offset>]> | <von bis>]
#
###################################################################################
#
if [ -f /etc/uls/uls.conf ]
 then
  . /etc/uls/uls.conf
fi
#
if [ "$ULSSERVER" = "STORE" -o "$ULSSERVER" = "" ]
 then
  echo "ULS-Server ist nicht fr Abfragen konfiguriert."
  exit 1
fi
#
if [ $# -lt 5 ]
 then
  echo "usage: $0 server section teststep details einheit [<datcode> [<-offset>] | <von bis>]"
  exit 1
fi
#
S=`/usr/local/bin/code_http "$1"`
K=`/usr/local/bin/code_http "$2"`
T=`/usr/local/bin/code_http "$3"`
D=`/usr/local/bin/code_http "$4"`
E=`/usr/local/bin/code_http "$5"`
if [ ! -z "$6" ]
 then
  V=`/usr/local/bin/code_http "$6"`
  if [ -z "$7" ]
   then
    DAT="&dat=$V"
  else
    B=`/usr/local/bin/code_http "$7"`
    if echo  "$7" | grep -q ' '
     then
      DAT="&von=$V&bis=$B"
    else
      DAT="&dat=$V&ddif=$B"
    fi
  fi
else
  DAT=""
fi
#
/usr/local/bin/httpget $SFLAGS -c -s $ULSSERVER "get_last_server_values.s2w?server=$S&section=$K&teststep=$T&details=$D&einheit=$E$DAT"

