Dynamic DNS Script Not Updating DNS Records.
I use a DDNS script that is executed daily (as a cronjob) to update my DNS records with the correct IP that I am given by my ISP (Verizon).
However, as of today it stopped working. Even manually running the script from different computers nothing gets updated. Below is my script and the output it gives.
#!/bin/bash
#Debug
#set -x
#Private Key
KEY="key"
#Domain ID
DID="729317"
#Resource ID
RID[1]="5494854"
RID[2]="5494843"
RID[3]="5494856"
RID[4]="5494857"
RID[5]="5494855"
HOST="https://api.linode.com/"
ACTION="domain.resource.update"
LOGFILE="/var/log/linode_ddns.log"
#Echo the date of the update once
echo "Updated on $(date) : " >> $LOGFILE
#The param remote_addr automatically gets the IP of the machine that the request was made from.
for index in 1 2 3 4 5
do
URL="${HOST}?api_key=${KEY}&api_action=${ACTION}&domainid=${DID}&resourceid=${RID[index]}&target[remote_addr]"
wget --inet4-only -qO- --no-check-certificate "$URL" >> $LOGFILE
done
exit 0
Output :
4 Updated on Sat Feb 13 21:51:55 EST 2016 :
22:04:09 EST 2016 :
{"ERRORARRAY":[],"DATA":{"ResourceID":5494854},"ACTION":"domain.resource.update"}{"ERRORARRAY":[],"DATA":{"ResourceID":5494843},"ACTION":"domain.resource.update"}{"ERRORARRAY":[],"DATA":{"ResourceID":5494856},"ACTION":"domain.resource.update"}{"ERRORARRAY":[],"DATA":{"ResourceID":5494857},"ACTION":"do main.resource.update"}{"ERRORARRAY":[],"DATA":{"ResourceID":5494855},"ACTION":"domain.resource.update"}
Things I have done :
Delete the old key, resource id and domain id. I made new ones.
Run the script from 3 different machines. (Centos 6.5, Windows 7 and Windows Server 2012)
Run it manually from the CLI.
Checked the API Docs to make sure I am using domain.resources.update correctly.
I don't get any of the errors shown in the API docs as shown by the above output.
I am asking for any possible clues as to why it is not updating/failing or how to troubleshoot it further?
Thank you.
3 Replies
- Les
> Also, what's going on with "&target[remote_addr]" in your request? Where is the delimiter separating the key from its value?
Thank you that was the issue. I missed the delimiter. Working great now.