improved robustness of update script in case of connection trouble (wget may hang a long time if DNS fails or route is unavailable)

This commit is contained in:
Daniel Steglich 2015-01-05 17:08:15 +00:00
parent cb52d7fcf0
commit 6b6e7f695f

View File

@ -6,6 +6,8 @@
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
#static values
WGET=$(which wget)
WGETOPTIONS="-4 -o /dev/null -t 3 -T 3"
EMPTYSTRING="none"
NOIP="0.0.0.0"
#how often do we poll for IP changes if we are behind a NAT?
@ -130,7 +132,7 @@ doGetWANIP()
{
if [ ! -z $IPURL ];then
OUTFILE=`mktemp`
wget -4 -o /dev/null -O $OUTFILE $IPURL
$WGET $WGETOPTIONS -O $OUTFILE $IPURL
WANIP=`cat $OUTFILE`
rm $OUTFILE
else