Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/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