Created
December 2, 2014 08:36
-
-
Save b0c1/292a80b5802a3cdb6e2c to your computer and use it in GitHub Desktop.
nsupdate.info bash script
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 | |
USER="boci.nsupdate.info" | |
PASS="YEMLS9Yk2D" | |
UPDATE_COMMAND="curl -o status.ip -s --user $USER:$PASS --basic https://ipv4.nsupdate.info/nic/update" | |
curl -s https://ipv4.nsupdate.info/myip -o current.ip | |
if [ ! -f prev.ip ] | |
then | |
cp current.ip prev.ip | |
eval $UPDATE_COMMAND | |
else | |
if ! diff current.ip prev.ip >/dev/null ; then | |
rm current.ip | |
else | |
rm prev.ip | |
mv current.ip prev.ip | |
eval $UPDATE_COMMAND | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment