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