Created
May 19, 2016 21:25
-
-
Save jeffgeiger/cc8453750b3e5601802084314c82bb48 to your computer and use it in GitHub Desktop.
Dynamic IP update with notifications
This file contains hidden or 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 | |
CURRENTIP=$(curl http://ipinfo.io/ip 2>/dev/nulll) | |
if [[ $CURRENTIP != $(cat /tmp/ipdata) ]]; then | |
echo "CHANGE: $CURRENTIP - $(date) FROM: $(cat /tmp/ipdata)" | |
/usr/sbin/ez-ipupdate -c /etc/ez-ipupdate/default.conf -a $CURRENTIP | |
echo $CURRENTIP > /tmp/ipdata | |
curl -Lk -XPOST -d "apikey=xxxxxxxxxxxxxxxxxx&priority=-2&application=Labs&event=IP%20Change&description=New%20IP%3A%20${CURRENTIP}" https://api.prowlapp.com/publicapi/add | |
curl -A "DDUpdater - Dynamic DNS Updater - 0.0.1" -u '[email protected]:xxxxxxxxxx' https://updates.dnsomatic.com/nic/update?hostname=Home | |
else | |
echo "ALL GOOD - $(date) - $CURRENTIP" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment