Advertisement
Guest User

saitoxscript

a guest
Jan 14th, 2016
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. :global ddnsuser "priority"
  2. :global ddnspass "io2015"
  3. :global theinterface "pppoe-out1"
  4. :global ddnshost "overclock.dyndns-ip.com"
  5. :global ipddns [:resolve $ddnshost];
  6. :global ipfresh [ /ip address get [/ip address find interface=$theinterface ] address ]
  7. :if ([ :typeof $ipfresh ] = nil ) do={
  8. :log info ("DynDNS: No ip address on $theinterface .")
  9. } else={
  10. :for i from=( [:len $ipfresh] - 1) to=0 do={
  11. :if ( [:pick $ipfresh $i] = "/") do={
  12. :set ipfresh [:pick $ipfresh 0 $i];
  13. }
  14. }
  15.  
  16. :if ($ipddns != $ipfresh) do={
  17. :log info ("DynDNS: IP-DynDNS = $ipddns")
  18. :log info ("DynDNS: IP-Fresh = $ipfresh")
  19. :log info "DynDNS: Update IP needed, Sending UPDATE...!"
  20. :global str "/nic/update\?hostname=$ddnshost&myip=$ipfresh&wildcard=NOCHG&mx=NOCHG&backmx=NOCHG"
  21. /tool fetch address=members.dyndns.org src-path=$str mode=http user=$ddnsuser \
  22. password=$ddnspass dst-path=("/DynDNS.".$ddnshost)
  23. :delay 1
  24. :global str [/file find name="DynDNS.$ddnshost"];
  25. /file remove $str
  26. :global ipddns $ipfresh
  27. :log info "DynDNS: IP updated to $ipfresh!"
  28. } else={
  29. :log info "DynDNS: dont need changes";
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement