Last active
September 22, 2018 06:21
-
-
Save rsgalloway/44b5aa34566c64af8c3353b4ced124f3 to your computer and use it in GitHub Desktop.
Simple Namecheap Dynamic DNS client
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 | |
set -eu | |
# | |
# https://www.namecheap.com/support/knowledgebase/article.aspx/43/11/how-do-i-set-up-a-host-for-dynamic-dns | |
# | |
#FETCH="fetch -qo -" | |
# or for curl: | |
FETCH="curl -s" | |
# $1: your domain | |
# $2: subdomain to update use @ for TLD | |
# $3: the password given to you by Namecheap's web interface | |
# | |
# Rerun this script every 5 minutes. Crontab entry (not as root): | |
# */5 * * * * namecheap-ddns bla.com @ asdjfasfasdfasdf | |
domain=$1 | |
host=$2 | |
password=$3 | |
out=$(${FETCH} "https://dynamicdns.park-your-domain.com/update?host=${host}&domain=${domain}&password=${password}") | |
grep -q "<ErrCount>0</ErrCount>" <<EOF && exit 0 | |
${out} | |
EOF | |
cat <<EOF | |
${out} | |
EOF | |
exit 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment