-
-
Save kdmurray/6137628 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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