Created
May 4, 2014 16:48
-
-
Save dalhundal/89159b3f032588586e91 to your computer and use it in GitHub Desktop.
Shell script to update namecheap.com dynamic dns for a domain with your external IP address
This file contains hidden or 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/sh | |
# Shell script to update namecheap.com dynamic dns | |
# for a domain to your external IP address | |
HOSTNAME=yoursubdomain | |
DOMAIN=yourdomainname.com | |
PASSWORD=y0urp455w0rd | |
IP=`curl -s echoip.com` | |
curl "https://dynamicdns.park-your-domain.com/update?host=$HOSTNAME&domain=$DOMAIN&password=$PASSWORD&ip=$IP" |
Author
dalhundal
commented
Jan 14, 2024
via email
Documentation:
https://www.namecheap.com/support/knowledgebase/article.aspx/583/11/how-do-i-configure-ddclient/
As for why they chose to use that domain, that would be a question best
directed at them.
…On Sun, 14 Jan 2024 at 14:15, Alex Spurling ***@***.***> wrote:
***@***.**** commented on this gist.
------------------------------
Thanks - I did search and didn't find any mention of park-your-domain.com
in Namecheap's documentation. Why don't they use namecheap.com or
api.namecheap.com as their API domain?
—
Reply to this email directly, view it on GitHub
<https://gist.github.com/dalhundal/89159b3f032588586e91#gistcomment-4830332>
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAEIXZKL4OYBPIHBDAW6UVTYOPR7BBFKMF2HI4TJMJ2XIZLTSKBKK5TBNR2WLJDUOJ2WLJDOMFWWLO3UNBZGKYLEL5YGC4TUNFRWS4DBNZ2F6YLDORUXM2LUPGBKK5TBNR2WLJDHNFZXJJDOMFWWLK3UNBZGKYLEL52HS4DFVRZXKYTKMVRXIX3UPFYGLK2HNFZXIQ3PNVWWK3TUUZ2G64DJMNZZDAVEOR4XAZNEM5UXG5FFOZQWY5LFVAYTCNJRHE3TQONHORZGSZ3HMVZKMY3SMVQXIZI>
.
You are receiving this email because you authored the thread.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>
.
I made a couple of changes:
- Permits using "@" where you only have the TLD
- "silenced" the first curl
- Displays the Host and Domain values
- Changed the "dig"s to query dns1.registrar-servers.com since those are currently what NameCheap updates
#!/bin/bash
# Bash script to update Namecheap.com dynamic dns
DDNS_HOSTNAME="@"
DDNS_DOMAIN="YourDomainHere.com"
DDNS_PASSWORD="01234567890123456789012345678901"
CURRENT_IP=$(curl -s myip.dnsomatic.com)
if [[ "$DDNS_HOSTNAME" == "@" ]]; then
CURRENT_DDNS=$(dig +short $DDNS_DOMAIN @dns1.registrar-servers.com)
else
CURRENT_DDNS=$(dig +short $DDNS_HOSTNAME.$DDNS_DOMAIN @dns1.registrar-servers.com)
fi
echo "Hostname: $DDNS_HOSTNAME; Domain: $DDNS_DOMAIN"
echo "current Namecheap ddns record = $CURRENT_DDNS"
echo "current public IP address = $CURRENT_IP"
if [ "$CURRENT_DDNS" != "$CURRENT_IP" ]; then
curl "https://dynamicdns.park-your-domain.com/update?host=$DDNS_HOSTNAME&domain=$DDNS_DOMAIN&password=$DDNS_PASSWORD&ip=$CURRENT_IP"
fi
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment