#!/bin/sh
NUMTRY=3
TARGETDIR=/home/andreas/public_html/brocken

tmpdir=`mktemp -d`
cd $tmpdir
i=$NUMTRY
while [ $i -gt 0 ] ; do
    if get-loipe > get-loipe.log ; then
        break
    fi
    i=$((i-1))
done
if [ -e loipen.html ] ; then
    mv loipen.html $TARGETDIR
else
    mailx -s "get-loipen failed" andreas@fam-tille.de < get-loipe.log
fi
cd
rm -rf $tmpdir
