Skip to content

Instantly share code, notes, and snippets.

@haegrr
Created June 29, 2013 21:33
Show Gist options
  • Save haegrr/5892759 to your computer and use it in GitHub Desktop.
Save haegrr/5892759 to your computer and use it in GitHub Desktop.
#!/bin/sh
TTL=60
DYNDNS_CACHE=/tmp/dyndns_cache
ip=$(nvram get wan_ipaddr)
dyndns_ip=$(cat $DYNDNS_CACHE 2>/dev/null)
hostname=$(nvram get wan_hostname)
domain=$(nvram get wan_domain)
if [ "x$ip" = "x$dyndns_ip" ]; then
echo "ip address $ip has not changed"
else
echo -n $ip > $DYNDNS_CACHE
AWS_ACCESS_KEY_ID=$(nvram get aws_key_id) AWS_SECRET_ACCESS_KEY=$(nvram get aws_secret_key) cli53 rrcreate $domain $hostname A $ip --ttl $TTL --replace
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment