Skip to content

Instantly share code, notes, and snippets.

@b0c1
Created December 2, 2014 08:36
Show Gist options
  • Save b0c1/292a80b5802a3cdb6e2c to your computer and use it in GitHub Desktop.
Save b0c1/292a80b5802a3cdb6e2c to your computer and use it in GitHub Desktop.
nsupdate.info bash script
#!/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