#!/bin/sh
# Copyright (C) 2018-2022 Greenbone AG
#
# SPDX-License-Identifier: AGPL-3.0-or-later

ALERT_CONFIG="$1"
CONNECTOR=`which greenbone_vfire_connector`

if [ -z "$ALERT_CONFIG" ]
then
  echo "No alert config given." >&2
  exit 1
fi

if [ ! -f "$ALERT_CONFIG" ]
then
  echo "Alert config file not found." >&2
  exit 1
fi

if [ -z "$CONNECTOR" ]
then
  echo "Connector script 'greenbone_vfire_connector' not found." >&2
  exit 1
fi

"$CONNECTOR" "$ALERT_CONFIG"
EXIT_CODE=$?
exit $EXIT_CODE
