Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Linode dynamic DNS updating script
#!/bin/sh
# modified by jfro from http://www.cnysupport.com/index.php/linode-dynamic-dns-ddns-update-script
# Uses curl to be compatible with machines that don't have wget by default
LINODE_API_KEY=licensekey
DOMAIN_ID=domainid
RESOURCE_ID=resourceid
WAN_IP=`curl -s ifconfig.me/ip`
if [ -f $HOME/.wan_ip.txt ]; then
OLD_WAN_IP=`cat $HOME/.wan_ip.txt`
else
echo "No file, need IP"
OLD_WAN_IP=""
fi
if [ "$WAN_IP" = "$OLD_WAN_IP" ]; then
echo "IP Unchanged"
else
echo $WAN_IP > $HOME/.wan_ip.txt
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
fi
@mhussain

This comment has been minimized.

Show comment
Hide comment
@mhussain

mhussain May 8, 2012

updated the URL to curl to obtain current IP

Owner

mhussain commented May 8, 2012

updated the URL to curl to obtain current IP

@deepfryed

This comment has been minimized.

Show comment
Hide comment
@deepfryed

deepfryed May 8, 2012

feel good yak shave doing i see

deepfryed commented May 8, 2012

feel good yak shave doing i see

@mhussain

This comment has been minimized.

Show comment
Hide comment
@mhussain

mhussain May 8, 2012

Yak shaving is not bad when your original goal was to shave a Yak :)

Owner

mhussain commented May 8, 2012

Yak shaving is not bad when your original goal was to shave a Yak :)

@kdmurray

This comment has been minimized.

Show comment
Hide comment
@kdmurray

kdmurray Aug 2, 2013

@deepfryed the script is quite useful for updating a DNS entry for a subdomain you have hosted somewhere other than linode. home.mydomain.com can point to your home network, giving you a nice friendly DNS name which is easily updated from a linux or mac machine on your home network. #noYakShaving

kdmurray commented Aug 2, 2013

@deepfryed the script is quite useful for updating a DNS entry for a subdomain you have hosted somewhere other than linode. home.mydomain.com can point to your home network, giving you a nice friendly DNS name which is easily updated from a linux or mac machine on your home network. #noYakShaving

@curiousercreative

This comment has been minimized.

Show comment
Hide comment
@curiousercreative

curiousercreative Nov 19, 2014

Wonderful, I'm running this script every hour on my mac now.

curiousercreative commented Nov 19, 2014

Wonderful, I'm running this script every hour on my mac now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment