#!/bin/bash
#
# sccl_get_config_del
#
# Löschen von Datien unter /etc/sccl/scripts
##################################################################
#
. $(dirname $0)/globals.settings
#
if [[ "$STARTSTOPDIR" != /etc/sccl/* ]]; then
  echo "ERROR: Startstopdir not under /etc/sccl"
fi
#
clientip="$1"
delfiles="$2"
unset procfiles
#
for f in $delfiles; do
  if [[ $f == $STARTSTOPDIR/* ]]; then
    if [[ -f $f ]]; then
      echo "rm $f"
      rm $f
      procfiles="$procfiles${procfiles+, }$f"
    fi
  else
    echo "ERROR: $f not under $STARTSTOPDIR"
  fi
done
#
if [[ -n "$procfiles" && -n "$ULS" ]]; then
  DT="$(date '+%F %T%:z')"
  send_test_value -h DOMAIN:$THISHOSTNAME:SCCL "$CLUSTER" "Config:$THISHOSTNAME" "got from" $DT "$1" "[_]"
  send_test_value -h DOMAIN:$THISHOSTNAME:SCCL "$CLUSTER" "Config:$THISHOSTNAME" "Deleted" $DT "$procfiles" "_"
fi
