IP is different from the one in the file, it sends me a notification.
I need to set this up... MeaTLoTioN does something similar that will update his domain(s), too.
I use the service that's included with namecheap and a domain for a dynamic and have been doing
this for years.
This is the script. It's been working for me forever so I hope it helps!
#!/bin/bash
set -euo pipefail
HOST="home"
DOMAIN="domain.ca"
PASSWORD="yourpassword"
DNS_IP="$(dig +short "${HOST}.${DOMAIN}" | tail -n1)"
PUBLIC_IP="$(dig TXT +short o-o.myaddr.l.google.com @ns1.google.com | tr -d '"')"
if [[ -z "$PUBLIC_IP" ]]; then
echo "Could not determine public IP"
exit 1
fi
if [[ "$PUBLIC_IP" != "$DNS_IP" ]]; then
curl -fsS \
"
https://dynamicdns.park-your-domain.com/update?host=${HOST}&domain=${DOMAIN}&password=${PASSWORD}&ip=${PUBLIC_IP}"
echo "DNS updated: ${DNS_IP} → ${PUBLIC_IP}"
else
echo "No update needed (${PUBLIC_IP})"
fi
Shawn
--- SBBSecho 3.37-Linux
* Origin: _thePharcyde
telnet://bbs.pharcyde.org (Wisconsin) (21:1/700)