I’ve used Linode for many years, including as a DNS server for my domains. As such, when I wanted to add a domain to a device with a potentially dynamic IP address, I wanted to make use of the excellent Linode API.

Having found https://travismaynard.com/writing/dynamic-dns-using-the-linode-api I knew it was relatively easy, I just needed to work out how to convince the device to execute that API call. The device in question is an EdgeRouter POE (the 5 port version).

The other piece of the puzzle I needed was https://help.ubnt.com/hc/en-us/articles/204976164-EdgeRouter-Run-Operational-Mode-Command-from-Scripts . This page let me know that I needed to create a script in the /config/scripts folder, which I could then use as a scheduled task

So this is what I did.

cat > /config/scripts/linode.sh
curl -sg https://api.linode.com/?api_key=your-api-key\&api_action=domain.resource.update\&domainid=your-domain-id\&resourceid=your-resource-id\&target=[remote_addr]
echo "$(date +'%h %e %T')" hostname 'linode-ddns executed' >> /var/log/messages
exit 0

Then press Control-D to exit and save the script. Make the script executable and test it. Next, add it to the task scheduler.

set system task-scheduler task linode-ddns interval 30m
set system task-scheduler task linode-ddns executable path /config/scripts/linode.sh