Last active
September 22, 2018 02:15
-
-
Save bocajnotnef/c491e0695a252b51593f3c62abfad7b8 to your computer and use it in GitHub Desktop.
script to update namecheap dynamic dns
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 | |
# script to update the dynamic dns address of a namecheap domain | |
# usage: ./updater.sh <host> <domain> <password> | |
if [ "$#" -ne 3 ]; then | |
echo "Illegal number of parameters" | |
echo "usage: ${0} <host> <domain> <password>" | |
exit -1 | |
fi | |
HOST=$1 | |
DOMAIN=$2 | |
PASSWORD=$3 | |
public_ip=$(curl -s ipinfo.io/ip) | |
echo "Will now set ${host}.${domain} to IP ${public_ip}" | |
url="https://dynamicdns.park-your-domain.com/update?host=${HOST}&domain=${DOMAIN}&password=${PASSWORD}&ip=${public_ip}" | |
echo "Calling URL..." | |
result=$(curl -s $url) | |
echo "response: ${result}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment