SHARE
TWEET

dape

a guest Jan 29th, 2013 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2. DOMAIN="example.com"
  3. PASSWORD="PASS"
  4. online_ipv6=`curl -6 -s http://checkip.dns.he.net | grep -o -E '([A-Fa-f0-9]{1,4}:){7}[A-Fa-f0-9]{1,4}'`
  5. dns_ipv6=`host -t AAAA $DOMAIN ns4.he.net | grep -o -E '([A-Fa-f0-9]{1,4}:){7}[A-Fa-f0-9]{1,4}'`
  6.  
  7. if [ "$online_ipv6" != "$dns_ipv6" ]
  8.    then
  9.         echo `date` "- registering" $online_ipv6 "at dns.he.net." >> /var/log/dns.he.net.log
  10.         curl -s -6 "http://$DOMAIN:$PASSWORD@dyn.dns.he.net/nic/update?hostname=$DOMAIN"
  11. fi
  12.  
  13. echo `date` "- checked" $dns_ipv6 "with dns.he.net." >> /var/log/dns.he.net.log
  14.  
  15. online_ipv4=`curl -4 -s http://checkip.dns.he.net | grep -o -E '([0-9]{1,3}\.){3}[0-9]{1,3}'`
  16. dns_ipv4=`host -t A $DOMAIN ns4.he.net | grep -o -E '([0-9]{1,3}\.){3}[0-9]{1,3}'`
  17.  
  18. if [ "$online_ipv4" != "$dns_ipv4" ]
  19.    then
  20.     echo `date` "- registering" $online_ipv4 "at dns.he.net." >> /var/log/dns.he.net.log
  21.     curl -s -4 "http://$DOMAIN:$PASSWORD@dyn.dns.he.net/nic/update?hostname=$DOMAIN"
  22.    fi
  23.  
  24. echo `date` "- checked" $dns_ipv4 "with dns.he.net." >> /var/log/dns.he.net.log
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top