- Enable Dynamic DNS for your domain. You'll get a "password" that you can use for their API Endpoint.
- Replace variable values with your own.
- Put the script in a safe place (I just used my home folder)
- Set a cron job (or other recurring service) to run your script.
- ???
- Profit
-
-
Save jpts/bcdab17e0da7e729d35c4a22af905fc5 to your computer and use it in GitHub Desktop.
NameCheap Dynamic DNS Updater 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 | |
Host_Name=host | |
Domain=example.com | |
Password="PASS_HASH_FROM_NAMECHEAP" | |
IP_Address=$(curl -s icanhazip.com) | |
url="https://dynamicdns.park-your-domain.com/update?host=$Host_Name&domain=$Domain&password=$Password" | |
result=$(curl -s --globoff $url) | |
NEW_IP=$(echo $result | sed -E 's/^.*IP>(.+)<\/IP.*$/\1/') | |
DONE=$(echo $result | sed -E 's/^.*Done>(.+)<\/Done.*$/\1/i') | |
echo "Request URL: $url" | |
if [[ $DONE == 'true' ]]; then | |
echo "New IP: $NEW_IP" | |
else | |
echo "Success: $DONE" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment