#!/bin/bash
#
#  Copyright (C) 2011-2016, it-novum GmbH <community@openattic.org>
#
#  openATTIC is free software; you can redistribute it and/or modify it
#  under the terms of the GNU General Public License as published by
#  the Free Software Foundation; version 2.
#
#  This package is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.

set -e
set -u

for settings in "/etc/default/openattic" "/etc/sysconfig/openattic"
do
        [ -f $settings ] && . $settings
done

if [ ! -z "$RPCD_CERTFILE" -a ! -z "$RPCD_KEYFILE" ]; then
    CHECKSSL="-S"
else
    CHECKSSL=""
fi

set +e
"$NAGIOS_PLUGIN_DIR/check_tcp" -H 127.0.0.1 -p 31234 $CHECKSSL
exit $?
