Skip to content

Instantly share code, notes, and snippets.

@beigna
Created November 1, 2018 19:24
Show Gist options
  • Save beigna/2d432bf66907cef58cc671efb1ad1ff6 to your computer and use it in GitHub Desktop.
Save beigna/2d432bf66907cef58cc671efb1ad1ff6 to your computer and use it in GitHub Desktop.
#!/bin/sh
CURRENT_IP=/tmp/current_ip
ASSIGNED_IP=/tmp/assigned_ip
test -e $ASSIGNED_IP || touch $ASSIGNED_IP
curl http://ip.init.gdn:8989/txt -s -o $CURRENT_IP
cmp $CURRENT_IP $ASSIGNED_IP -s || (curl https://freedns.afraid.org/dynamic/update.php?__HASH_HERE__ && cp $CURRENT_IP $ASSIGNED_IP && echo "IP updated $(cat $CURRENT_IP)")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment