#!/bin/bash
#
# uls_set_suspension
#
# Aufruf:
#
# uls_set_suspension [-h hostname] <start> <end> [<section> [<teststep> [<detail> [<unit> [<access>]]]]]
#
##########################################################################################
#
if [[ -f /etc/uls/uls.conf ]]; then
  . /etc/uls/uls.conf
fi
#
if [[ -z "$ULSSERVER" || "$ULSSERVER" = "STORE" ]]; then
  echo "No connection to ULS server defined"
  exit 1
fi
#
unset sid remove update rem
while getopts cdr:i:h:? op; do
  case "$op" in
    c) update=1;;
    h) ULSHOSTNAME=$OPTARG;;
    i) sid="$OPTARG";;
    d) remove=1;;
    r) rem="$OPTARG";;
    *) echo "usage: `basename $0` [-c] [-i] [-d] [-h hostname] [-r <remark>] <start> <end> [<section> [<teststep> [<detail> [<unit> [<access>]]]]]
  -c          change suspension
  -i <sid>    change or remove suspension with ID <sid>
  -d          remove suspension
  -r <remark> set remark"
       exit 1;;
  esac
done
shift $(( $OPTIND - 1))
#
if [[ -n "$sid" && -z "$remove" ]]; then
  update=1
fi
#
httpget $SFLAGS -u logging -p lgput -s $ULSSERVER "set_suspension.s2w?hostname=$ULSHOSTNAME&id=$sid&remove=$remove&update=$update&start=$1&end=$2&section=$3&teststep=$4&detail=$5&unit=$6&access=$7&remark=$rem"
