#!/bin/ksh
#
# send_script2uls
#
# send_script2uls schickt das Protokoll, das per script erzeugt wird ans ULS
#
# Aufruf:
# send_script2uls <filename> <hostname> <Section> <Teststep> <Detail> <date time>
##############################################################################
#
trap '' 1 2 3 6 9 14 15
#
if [ $# -ne 6 ]
 then
  echo "usage: $0 <filename> <hostname> <Section> <Teststep> <Detail> <date time>"
  exit 1
fi
#
if [ ! -r "$1.fifo" ]
 then
  echo "$0: $1 ist nicht lesbar."
  exit 2
fi
#
umask 077
#
( MAGIC=$RANDOM
  /usr/local/bin/send_test_value -S -s adm -h "$2" "$3" "$4" "$5-Magic" $6 "$MAGIC" " "
  echo "Magic-Start: $MAGIC"
  cat "$1.fifo"
  echo "Magic-End: $MAGIC"
) | bzip2 | /usr/local/bin/send_stdin_file -S -s adm -a -b 10240 -h "$2" "$3" "$4" "$5" $6 "$1.bz2"
rm -f "$1.fifo"
