TXT record generation
[ssh-dyndns.git] / ssh-dyndns
index 67a13d9a66235c3fdbafea0e5ffd5546af67a2c9..cbbb1cd543bd5a0fed002253f0201d230974861e 100755 (executable)
@@ -76,7 +76,7 @@ djbdnsline="=${domain}:${remoteip}:${timeout}"
 
 update=1
 if [ -f "$datafile" ]; then
-    currentdata=`cat "$datafile"`
+    currentdata=`head -n1 "$datafile"|tr -d '\n'`
     if [ "$currentdata" = "$djbdnsline" ]; then
         #no need to update
         update=0
@@ -88,6 +88,11 @@ fi
 
 echo $djbdnsline > $datafile
 
+#TXT record with last update
+date=`date --rfc-3339=seconds|tr : .|tr -d '\n'`
+djbdnsTxtLine="'${domain}:Last update ${date}.:${timeout}"
+echo $djbdnsTxtLine >> $datafile
+
 #compile dns data
 cd "$data_dir"
 sudo make