#!/bin/bash
#
# user2uls
#
# user2uls 
# 
# Protokoll der Sitzung ans ULS senden
#####################################################################
#
if ! tty -s
 then
  echo "No Terminal connected!"
  exit 1
fi
#
if [[ -f /etc/uls/uls.conf ]]
 then
  . /etc/uls/uls.conf
fi
if [[ -z "$ULSHOSTNAME" ]]
 then
  ULSHOSTNAME=`hostname`
fi
#
stoptouls()
{
  DE="`date '+%Y-%m-%d %H:%M:%S%:z'`"
  #
  send_test_value -S -s adm Security User-Dialog Start-Stop $ULSDT "Stop $DE" '{T}'
  exit 0
}
#
typeset -r THIS_USER=$USER
#
trap 'stoptouls' 1 2 3 6 9 14 15
#
typeset -r ULSDT="`date '+%Y-%m-%d %H:%M:%S%:z'`"
#
send_test_value -S -s adm Security User-Dialog Start-Stop $ULSDT "Start $ULSDT" '{T}'
send_test_line -S -s adm Security User-Dialog $ULSDT "User:$THIS_USER: "
#
script2uls "$THIS_USER" "$ULSHOSTNAME" Security User-Dialog Dialog "$ULSDT"
#
stoptouls
