Skip to content

Instantly share code, notes, and snippets.

@n7st
Created March 8, 2015 16:15
Show Gist options
  • Save n7st/7ed28b6edba3b8ebb383 to your computer and use it in GitHub Desktop.
Save n7st/7ed28b6edba3b8ebb383 to your computer and use it in GitHub Desktop.
Basic "dynamic DNS" subdomain updater thingy
#!/bin/bash
# Find your current IP address
ip=`dig +short myip.opendns.com @resolver1.opendns.com`
# Subdomain to update
subdomain="SUBDOMAIN_HERE"
# Example for Linode DNS
api_key="API_KEY_HERE"
api_call="https://api.linode.com/?api_key=$api_key&api_action=domain.resource.update"
api_call="$api_call&DomainID=DOMAIN_ID_HERE&Type=A&Target=$ip&Name=$subdomain"
api_call="$api_call&resourceid=RESOURCE_ID_HERE"
response=$(curl $api_call);
echo "$response";
@n7st
Copy link
Author

n7st commented Mar 8, 2015

Cheapskate cron-job.

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