#!/bin/sh
#
# smt-repeated-register


PATH="/sbin:/usr/sbin:/usr/bin:/bin"
SMTCMD=/usr/sbin/smt
. /etc/smt.d/smt-cron.conf

while read line ; do
    case "$line" in
    \#*|"") continue ;;
    esac
    eval val=${line#*=}
    case "$line" in
    PROXY_ENABLED=*)
        PROXY_ENABLED="${val}"
        ;;
    HTTP_PROXY=*)
        test -n "$val" || continue
        http_proxy="${val}"
        export http_proxy
        ;;
    HTTPS_PROXY=*)
        test -n "$val" || continue
        https_proxy="${val}"
        export https_proxy
        ;;
        esac
done < /etc/sysconfig/proxy
unset sys line val

if test "$PROXY_ENABLED" != "yes" ; then
    unset http_proxy https_proxy
fi
unset PROXY_ENABLED


if [ -x ${SMTCMD}-register ]
then
    ${SMTCMD}-register ${REGISTER_PARAMS}
else
    echo "WARNING: Could not find the SMT binary ${SMTCMD}-register"
    echo "         Please make sure SMT is properly installed."
fi

# in cronjobs always do an exit 0 - even on errors - exit 1 only in case of real panic
exit 0
