Advertisement
HittingSmoke

Untitled

Dec 19th, 2015
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.65 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. DomainName=
  4. Username=
  5. Password=
  6. WANInterface=
  7.  
  8. CurrWANIP=$(ip -o -4 addr show $WANInterface | awk -F '[ /]+' '{print $4}')
  9. GDNSIP=$(dig $MyGDomain +short)
  10.  
  11. if [ "$CurrWANIP" == "$GDNSIP" ]; then
  12.         logger "Google Domains DDNS: WAN IP ($CurrWANIP) unchanged, no update necessary"
  13. else
  14.         ipupdate=$(curl -s https://$Username:$Password@domains.google.com/nic/update?hostname=$MyGDomain&myip=$CurrWANIP)
  15.         if [ "$ipupdate" == "good $CurrWANIP" ]; then
  16.          logger "Google Domains DDNS: DNS updated to $CurrWANIP from $GDNSIP"
  17.         else
  18.          logger -s "Google Domains DDNS: Error: $ipupdate"
  19.         fi
  20. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement