Skip to content

Instantly share code, notes, and snippets.

@kdmurray
Forked from mhussain/update-dns.sh
Last active December 20, 2015 13:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kdmurray/6137628 to your computer and use it in GitHub Desktop.
Save kdmurray/6137628 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Modified by kdmurray from the source at https://gist.github.com/mhussain/2634050
# - Removed the comparison to the old WAN IP, forces an update each time the script is run
# - Added the touch command to an empty hidden file (~/.last-linode-ddns-refresh) to show
# when the last DDNS update took place.
LINODE_API_KEY=your-linode-api-key
DOMAIN_ID=your-domainid
RESOURCE_ID=your-domain-resourceid
echo "Fetching public IP address..."
WAN_IP=`curl -s ifconfig.me/ip`
echo "Updating DNS to $WAN_IP"
curl -s https://api.linode.com/?api_key="$LINODE_API_KEY"\&api_action=domain.resource.update\&DomainID="$DOMAIN_ID"\&ResourceID="$RESOURCE_ID"\&Target="$WAN_IP" > /dev/null
touch ~/.last-linode-ddns-refresh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment