Skip to content

Instantly share code, notes, and snippets.

@berend
Created November 15, 2021 17:25
Show Gist options
  • Save berend/77eed2c2a8c7bfc00ed0e8b48cfe600d to your computer and use it in GitHub Desktop.
Save berend/77eed2c2a8c7bfc00ed0e8b48cfe600d to your computer and use it in GitHub Desktop.
noip update with up-to-date check in a shell script
#!/usr/bin/env bash
# set env variables or directly here
NOIPDOMAIN=<your domain>
NOIPUSER=<your noip update username>
NOIPPASS=<your noip password>
CURRENT_IP=$(dig +short $NOIPDOMAIN | tail -n1)
MY_IP=$(dig @resolver4.opendns.com myip.opendns.com +short)
if [[ "$CURRENT_IP" == "$MY_IP" ]]
then
echo "redirect is up to date, pointing to $MY_IP"
else
echo "updating redirect from ip $CURRENT_IP to ip $MY_IP"
curl https://$NOIPUSER:[email protected]/nic/update?hostname=$NOIPDOMAIN&myip=$MY_ID
fi
@berend
Copy link
Author

berend commented Nov 15, 2021

After some more debugging & googling, it was probably not the fritz box, but noip.com. I recommend Free DNS now. Very simple setup, but just works!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment