Skip to content

Instantly share code, notes, and snippets.

@dayvonjersen
Created September 27, 2016 18:16
Show Gist options
  • Save dayvonjersen/10093378c8bbd34ceb04738af8c6e179 to your computer and use it in GitHub Desktop.
Save dayvonjersen/10093378c8bbd34ceb04738af8c6e179 to your computer and use it in GitHub Desktop.
#!/bin/bash
#
# Simple DynDNS Update for afraid.org
# Updated Wed Oct 8 08:00:35 2014
# Updated Tue 21 Jul 2015 06:15:31 AM EDT
# - Uses Bash now!
CURRENT_IP=$(dig +short myip.opendns.com @resolver1.opendns.com)
LAST_IP=$(cat /var/spool/cron/current_ip)
if [ "$CURRENT_IP" = "" ]; then
echo 'Connection down!';
elif [ "$CURRENT_IP" != "$LAST_IP" ]; then
echo "$CURRENT_IP" > /var/spool/cron/current_ip
curl http://freedns.afraid.org/dynamic/update.php? # ...
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment