From b40309b6a62136907c0d44301048dbf377e0dea7 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Tue, 5 Feb 2013 22:18:01 +0100 Subject: [PATCH] do not update if nothing changed --- ssh-dyndns | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/ssh-dyndns b/ssh-dyndns index 18fc5d9..00259d2 100755 --- a/ssh-dyndns +++ b/ssh-dyndns @@ -17,6 +17,7 @@ if [ -z "$remoteip" ]; then exit 2 fi +#TODO: support multiple domains if [ -z "$2" ]; then echo Missing argument: domain name exit 3 @@ -71,7 +72,19 @@ fi #=cweiske.de:5.35.241.22 djbdnsline="=${domain}:${remoteip}:${timeout}" -#FIXME: do not update if nothing changed + +update=1 +if [ -f "$datafile" ]; then + currentdata=`cat "$datafile"` + if [ "$currentdata" = "$djbdnsline" ]; then + #no need to update + update=0 + fi +fi +if [ $update -eq 0 ]; then + exit +fi + echo $djbdnsline > $datafile #compile dns data -- 2.30.2