0

Like the title says. At freedns.afraid.org website interface I can set the TTL if I'm premium. But how can I set it to 5s instead of the default 1h using/extending this script:

#!/bin/sh
#FreeDNS updater script

UPDATEURL="http://freedns.afraid.org/dynamic/update.php?_YOURAPIKEYHERE_"
DOMAIN="_YOURDOMAINHERE_"

registered=$(nslookup $DOMAIN|tail -n2|grep A|sed s/[^0-9.]//g)

  current=$(wget -q -O - http://checkip.dyndns.org|sed s/[^0-9.]//g)
       [ "$current" != "$registered" ] && {                           
          wget -q -O /dev/null $UPDATEURL 
          echo "DNS updated on:"; date
  }

UPDATE: using a direct link, it takes ~5 min for the update to take effect. The update itself does not even take a 1s.

topkek
  • 1
  • 1
  • There is no timer in that script. You need to adjust the way the script is being called. – tater Dec 15 '20 at 10:52
  • I would call it at every startup. – topkek Dec 15 '20 at 11:34
  • In that case it is not running every hour. – tater Dec 15 '20 at 11:50
  • No but the update takes an hour. If I execute this script (or change the IP manually at the website) the IP mapped to the subdomain changes only 1 hour later. – topkek Dec 15 '20 at 12:31
  • Oh, that is asking a different question than I understood it. In that case, it is unlikely you would be able to modify the script to produce the desired result; you would need to look at the API for the specific DDNS service provider. However, if you need 5 second granularity your business should probably invest in a static IP with a business-grade ISP. – tater Dec 15 '20 at 12:37
  • I've found a way to do it with a direct link like this: https://freedns.afraid.org/dynamic/update.php?_SOMELONGHASH_ Now it takes only 5 minutes. – topkek Dec 15 '20 at 18:18

0 Answers0