godaddy-ddns
godaddy-ddns copied to clipboard
Cannot update it
hi, i do not know if godaddy changed API recently, your script is not working recently. the error just showing "fail". i was able to use your script to update ddns.
thanks ET
me too
the api was slightly changed by godaddy to use square brackets around put requests like so: [{"data":"111.123.234.345","name":"@","ttl":3600,"type":"A"}] (an array) instead of {"data":"124.180.19.215","name":"@","ttl":3600,"type":"A"}, the script has been updated
The Update= line works to update the DNS entry, however it always says it fails (and gives no reason as to why), and always updates even if the entry matches the current IP.
I've written a pull request to fix that but it hasn't been approved yet
Tested the changes and yes, that resolves the fail/success issue, however it will still run even if the IP does not need to be changed. The Check= line is not parsing the json properly to get ONLY the IP, and thus it does not match.
it should be writing your old IP to /tmp/current_ip and comparing that - do you have write access to that file? does it contain your cached IP?
It is cached, however my server randomly reboots from time to time, deleting the temp file. If I remove that, it fails the check and forces an update even if the IP is the same as the DNS entry.
ah ok, maybe change the path of the file to somewhere it wont be deleted - '~/current_ip' perhaps
That solution only covers up the problem that the Check= line is malformed and fails 100% of the time.
I've mocked up a solution: Replace the end of the Check= line after the pipe with: |sed -r 's/([|])//g' | jq -r '.data'
This uses jq (json parser utility) to pull out the data variable, but you need to strip out the square-braces so it can do so. Hacky, but it works so far.
it's actually designed to overwrite any existing DNS entry, is it a problem if it writes the same DNS as the existing entry? The script could be reworked to compare the existing IP to the one in DNS and only update if it's different, rather than using a temp file
Why poll GoDaddy for the IP assigned, but then ignore the result? A wasted query. Also, it isn't a problem to overwrite with identical information, but it can easily be avoided.
you're right, I'd missed your point initially
Should be resolved now
@fexofenadine Thanks for your pull requests!
Glad to help out!