Advertisement
Guest User

MT-dynu

a guest
Sep 7th, 2022
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1.  
  2.  
  3. ## Dynu DDNS Updater Script ################
  4.  
  5. # Define User Variables
  6. :global ddnsuser "felh.név"
  7. :global ddnspass "jelszó"
  8. :global ddnshost "valamisajatnév.dynu.net"
  9. :global ipddns [:resolve $ddnshost]
  10.  
  11. # Get the current IP address from the internet
  12. :log info "DynuDDNS: Updater script running..."
  13. /tool fetch mode=http address="checkip.dynu.com" src-path="/" dst-path="/dynu.checkip.html"
  14. :local result [/file get dynu.checkip.html contents]
  15.  
  16. # Parse the current IP result
  17. :local resultLen [:len $result]
  18. :local startLoc [:find $result ": " -1]
  19. :set startLoc ($startLoc + 2)
  20. :local currentIP [:pick $result $startLoc $resultLen]
  21.  
  22. # Did we get an IP address to compare?
  23. :if ($ipddns != $currentIP) do={
  24. :log info ("DynuDDNS: IP-Dynu = $ipddns")
  25. :log info ("DynuDDNS: IP-Fresh = $currentIP")
  26. :log info "DynuDDNS: Update IP needed, Sending UPDATE...!"
  27. :global str "/nic/update?hostname=$ddnshost&myip=$currentIP"
  28. :log info "currentIP is $currentIP"
  29. /tool fetch address=api.dynu.com src-path=$str mode=http user=$ddnsuser password=$ddnspass dst-path=("/Dynu.".$ddnshost)
  30. :delay 1
  31. :global str [/file find name="Dynu.$ddnshost"]
  32. /file remove $str
  33. :global ipddns $currentIP
  34. :log info "DynuDDNS: IP updated to $currentIP!"
  35. } else={
  36. :log info "DynuDDNS: No change needed"
  37. }
  38.  
  39.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement