Created
November 15, 2021 17:25
-
-
Save berend/77eed2c2a8c7bfc00ed0e8b48cfe600d to your computer and use it in GitHub Desktop.
noip update with up-to-date check in a shell 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
#!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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!