fixed an issue where first update after initial configuration will not work because the cronjob does not recognize the ip change

This commit is contained in:
Daniel Steglich 2015-01-05 21:14:07 +00:00
parent 91cc161f96
commit d2fdf1d403

View File

@ -139,7 +139,6 @@ doGetWANIP()
#no WAN IP found because of missing check URL
WANIP=${NOIP}
fi
echo $WANIP > $IPFILE
}
cmd=$1
@ -174,7 +173,7 @@ case $cmd in
if [ "$OLDIP" != "$WANIP" -a "${WANIP}" != ${NOIP} ];then
${UPDATE_TOOL} -c $FILE
RESULT=$?
[ $RESULT -eq 0 ] && $0 success
[ $RESULT -eq 0 ] && $0 success $WANIP
cat /proc/uptime |awk '{print $1}' |cut -d . -f 1 > $LASTUPDATE
fi
#if we don't know our WAN IP do a blind update once a hour
@ -186,7 +185,7 @@ case $cmd in
if [ $DIFF -gt $UPDATEMINUTESUNKNOWN ];then
${UPDATE_TOOL} -c $FILE
RESULT=$?
[ $RESULT -eq 0 ] && $0 success
[ $RESULT -eq 0 ] && $0 success $WANIP
cat /proc/uptime |awk '{print $1}' |cut -d . -f 1> $LASTUPDATE
fi
fi
@ -202,6 +201,7 @@ case $cmd in
success)
DATE=`date`
echo "last update done ($DATE)" > $STATUSFILE
echo $1 > $IPFILE
;;
failed)
DATE=`date`
@ -237,7 +237,7 @@ case $cmd in
rm ${CFGDIR}/*
;;
*)
echo "usage: status|configure <options>|start|stop|update|get-nat|clean|success|failed"
echo "usage: status|configure <options>|start|stop|update|get-nat|clean|success [updated IP]|failed"
echo ""
echo "options are:"
echo "-s <server> Gnudip Server address"
@ -248,7 +248,7 @@ case $cmd in
echo ""
echo "update do a one time update"
echo "clean delete configuration"
echo "success store update success"
echo "success store update success and optional the updated IP"
echo "failed store update failure"
echo "get-nat return the detected nat type"
;;