Advertisement
tetratheta

namecheap Dynamic DNS bash script

Feb 16th, 2021
940
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.56 KB | None | 0 0
  1. #!/bin/sh
  2. set -eu
  3. #FETCH="fetch -qo -"
  4. # or for curl:
  5. FETCH="curl -s"
  6. # $1: your domain
  7. # $2: subdomain to update use @ for TLD
  8. # $3: the password given to you by Namecheap's web interface
  9. #
  10. # Rerun this script every 5 minutes. Crontab entry (not as root):
  11. # */5 * * * *  namecheap bla.com www asdjfasfasdfasdf
  12.  
  13. domain=$1
  14. host=$2
  15. password=$3
  16.  
  17. out=$(${FETCH} "https://dynamicdns.park-your-domain.com/update?host=${host}&domain=${domain}&password=${password}")
  18. grep -q "<ErrCount>0</ErrCount>" <<EOF && exit 0
  19. ${out}
  20. EOF
  21. cat <<EOF
  22. ${out}
  23. EOF
  24. exit 1
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement