Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## Dynu DDNS Updater Script ################
- # Define User Variables
- :global ddnsuser "felh.név"
- :global ddnspass "jelszó"
- :global ddnshost "valamisajatnév.dynu.net"
- :global ipddns [:resolve $ddnshost]
- # Get the current IP address from the internet
- :log info "DynuDDNS: Updater script running..."
- /tool fetch mode=http address="checkip.dynu.com" src-path="/" dst-path="/dynu.checkip.html"
- :local result [/file get dynu.checkip.html contents]
- # Parse the current IP result
- :local resultLen [:len $result]
- :local startLoc [:find $result ": " -1]
- :set startLoc ($startLoc + 2)
- :local currentIP [:pick $result $startLoc $resultLen]
- # Did we get an IP address to compare?
- :if ($ipddns != $currentIP) do={
- :log info ("DynuDDNS: IP-Dynu = $ipddns")
- :log info ("DynuDDNS: IP-Fresh = $currentIP")
- :log info "DynuDDNS: Update IP needed, Sending UPDATE...!"
- :global str "/nic/update?hostname=$ddnshost&myip=$currentIP"
- :log info "currentIP is $currentIP"
- /tool fetch address=api.dynu.com src-path=$str mode=http user=$ddnsuser password=$ddnspass dst-path=("/Dynu.".$ddnshost)
- :delay 1
- :global str [/file find name="Dynu.$ddnshost"]
- /file remove $str
- :global ipddns $currentIP
- :log info "DynuDDNS: IP updated to $currentIP!"
- } else={
- :log info "DynuDDNS: No change needed"
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement