My third-party DDNS account stopped working recently.
It seems CF has moved to a new API (v4).
The very good news is you can ditch the third-party and simply run a DDNS shell script as a cron job every minute on your webserver, calling the new CF API directly.
Yep, yours is way better than relying on a third party service.
I use a similar script, but for the IP address on an eth port so I end up with an internal address in my domain. It uses an ifconfig command, I believe.
In your script, I tried dig +short myip.opendns.com @resolver1.opendns.com, but the result was blank. When I use the curl command, it does return my IP address like so:
dig works as expected on my network, but thanks for pointing out it may not on other configurations. I removed it from the posted code for the sake of simplicity. The time difference is really only a few seconds.
I know this post will attract some attention - there must be a lot of folks out there whose DDNS services suddenly just stopped working on CF due to the API upgrade (which was announced and scheduled years ago).
Looks great. I was using DynDNS for one of our setups but looks like I could just move to CF based solution and need not rely on other services. BTW could you maybe put this up on GitHub?