Created
August 26, 2021 13:22
-
-
Save ttscoff/fab7137c71d951d36b166622a4d5800d to your computer and use it in GitHub Desktop.
Namecheap DDNS for Synology
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 | |
## Namecheap DDNS updater for Synology | |
## Brett Terpstra <https://brettterpstra.com> | |
PASSWORD="$2" | |
DOMAIN="$3" | |
IP="$4" | |
PARTS=$(echo $DOMAIN | awk 'BEGIN{FS="."} {print NF?NF-1:0}') | |
# If $DOMAIN has two parts (domain + tld), use wildcard for host | |
if [[ $PARTS == 1 ]]; then | |
HOST='@' | |
DOMAIN=$DOMAIN | |
# If $DOMAIN has a subdomain, separate for HOST and DOMAIN variables | |
elif [[ $PARTS == 2 ]]; then | |
HOST=${DOMAIN%%.*} | |
DOMAIN=${DOMAIN#*.} | |
fi | |
RES=$(curl -s "https://dynamicdns.park-your-domain.com/update?host=$HOST&domain=$DOMAIN&password=$PASSWORD&ip=$IP") | |
ERR=$(echo $RES | sed -n "s/.*<ErrCount>\(.*\)<\/ErrCount>.*/\1/p") | |
if [[ $ERR -gt 0 ]]; then | |
echo "badauth" | |
else | |
echo "good" | |
fi |
https://brettterpstra.com/2021/08/26/custom-urls-for-your-synology-with-namecheap/
Thank you for your kind and quick response.
Unfortunately it didn't work for me. :( I followed the steps as mentioned, and the platform shows the connection with Namecheap as correct, however the IP address is not updated.
Attached images.
Thank you for this script! Are you able to improve the parsing logic so that it accepts TLDs with multiple parts? For example:
domain.co.uk
domain.com.au
domain.co.nz
Best regards
I'm afraid I don't have time to rewrite the script to handle multi-part
TLDs right now, but you could always hardcode it instead of having it
split it automatically.
…On 7 Aug 2022, at 12:45, gwythan wrote:
Thank you for this script! Are you able to improve the parsing logic
so that it accepts TLDs with multiple parts? For example:
domain.co.uk
domain.com.au
domain.co.nz
Best regards
--
Reply to this email directly or view it on GitHub:
https://gist.github.com/fab7137c71d951d36b166622a4d5800d#gistcomment-4258861
You are receiving this because you authored the thread.
Message ID: ***@***.***>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Any instructions about how to install it?