From 6acc4cc44f7118cd3e5e0fa6d5f627504ac531fb Mon Sep 17 00:00:00 2001 From: Daniel Steglich Date: Fri, 6 Mar 2015 21:34:57 +0100 Subject: [PATCH] only do a update if DNS entry is outdated --- actions/dynamicdns | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/actions/dynamicdns b/actions/dynamicdns index cf1207518..add28abb6 100755 --- a/actions/dynamicdns +++ b/actions/dynamicdns @@ -269,23 +269,26 @@ doGetWANIP() # this function is called via cronjob doUpdate() { + dnsentry=$(nslookup ${host}|tail -n2|grep A|sed s/[^0-9.]//g) + if [ "${dnsentry}" = "${wanip}" ];then + return + fi if [ ! -z ${server} ];then start-stop-daemon -S -x ${UPDATE_TOOL} -m -p ${PIDFILE} -- -c ${cfgfile} fi - if [ ! -z ${updateurl} ];then doReplaceVars if [ "${basicauth}" = "enabled" ];then - local wgetoptions=" --user $user --password $pass " + local wgetoptions=" --user ${user} --password ${pass} " fi if [ "${ignoreCertError}" = "enabled" ];then local wgetoptions=" --no-check-certificate " fi - $WGET ${wgetoptions} "${updateurl}" + ${WGET} ${wgetoptions} "${updateurl}" # ToDo: check the returning text from WEB Server. User need to give expected string. - if [ $? -eq 0 ];then - ${0} success $wanip + if [ ${?} -eq 0 ];then + ${0} success ${wanip} else ${0} failed fi