#!/bin/sh
#
# run
# Updatedd by Philipp Benner
#          http://updatedd.philipp-benner.de
#
echo "Edit this file!"		## remove these
exit 1				## two lines!
#

HOSTNAME="test.domain.org"
TOKEN="1234567890"
#USER="user@domain.org"		## use either user and pass or token
#PASS="secure"
SERVICE="regfish"
FLAGS="-S $SERVICE -n $HOSTNAME -t $TOKEN -y"
#FLAGS="-S $SERVICE -n $HOSTNAME -u $USER:$PASS -y"
MAX_RETRY=10			## number of retries on connection problems

MYPATH="/bin /sbin /usr/bin /usr/sbin /usr/local/bin /usr/local/sbin"
for dir in $MYPATH; do
	if [ -x $dir/updatedd ]; then
		UPDATEDD=$dir/updatedd
	fi
done

if [ -z $UPDATEDD ]; then
	echo "updatedd seems not to be installed"
fi

$UPDATEDD $FLAGS
while [ $? == 1 ]; do
                                                                                                                             
        if [ $MAX_RETRY == 0 ]; then
            exit 0;
        fi
        let "MAX_RETRY--";
        $UPDATEDD $FLAGS
done

exit 0
