Created
March 8, 2015 16:15
-
-
Save n7st/7ed28b6edba3b8ebb383 to your computer and use it in GitHub Desktop.
Basic "dynamic DNS" subdomain updater thingy
This file contains 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/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"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Cheapskate cron-job.