This is the no-ip script I use:
:global scriptemail
:global ddnsurl1
:global ddnsurl2
:local wanipchecklast
:local wanipchecknow
:local wanipchanged "no"
:local ddnsuser "xxx"
:local ddnspass "xxx
:local ddnshost1 "xxx"
:local ddnshost2 "xxx"
:log info "******************** starting - ddns********************"
:log info "-"
/tool fetch url="
http://www.ipmon.co.za/ip.php" dst-path="ddns wan ip address.txt"
:log info "checkking for wan ip address"
:set wanipchecklast [/ip firewall address-list get value-name=comment number=[find list="my wan ip"]]
:set wanipchecknow "$[/file get "ddns wan ip address.txt" contents] "
:log info "current wan ip address: $wanipchecknow"
:log info "prevouis wan ip address: $wanipchecklast"
:log info "$[/system identity get name] wan ip address http://$wanipchecknow"
:if ($wanipchecknow != $wanipchecklast) do={
:log info "wan ip address has chaged"
:set wanipchanged "yes"
/ip firewall address-list set comment=$wanipchecknow number=[find list="my wan ip"]
:log warning "$[/system identity get name] wan ip address changed: $wanipchecklast -> $wanipchecknow"
:log info "updateing ddns host $ddnshost"
/tool fetch mode=http user=$ddnsuser password=$ddnspass url="
http://dynupdate.no-ip.com/nic/update\3 ... ipchecknow" dst-path="ddns update result.txt" keep-result=yes
:delay 15s;
/tool fetch mode=http user=$ddnsuser password=$ddnspass url="
http://dynupdate.no-ip.com/nic/update\3 ... ipchecknow" dst-path="ddns update result.txt" keep-result=yes
:set ddnsurl1 "
http://dynupdate.no-ip.com/nic/update\3 ... ipchecknow"
:set ddnsurl2 "
http://dynupdate.no-ip.com/nic/update\3 ... ipchecknow"
:log info "ddns result: $[/file get "ddns update result.txt" contents] "
}
:if ($wanipchanged = "yes") do={
:log info "generating ddns email report"
:global scriptemail
:local logcontenttemp ""
:local logcontent ""
:set logcontenttemp "Good Day \n\r"
:set logcontent ("$logcontent
" ."$logcontenttemp")
:set logcontenttemp "This is an automated notification, please do not reply to this email"
:set logcontent ("$logcontent
" ."$logcontenttemp")
:set logcontenttemp "Please see below ddns update email report: \n\r"
:set logcontent ("$logcontent
" ."$logcontenttemp")
:set logcontenttemp "*****************************************ddns report***********************************"
:set logcontent ("$logcontent
" ."$logcontenttemp")
:set logcontenttemp "Current wan ip address: $wanipchecknow \n\r"
:set logcontent ("$logcontent
" ."$logcontenttemp")
:set logcontenttemp "Prevouis wan ip address: $wanipchecklast \n\r"
:set logcontent ("$logcontent
" ."$logcontenttemp")
:set logcontenttemp "Update url: $ddnsurl1 \n\r"
:set logcontent ("$logcontent
" ."$logcontenttemp")
:set logcontenttemp "Update url: $ddnsurl2 \n\r"
:set logcontent ("$logcontent
" ."$logcontenttemp")
:set logcontenttemp "Update url result: $[/file get "ddns update result.txt" contents] \n\r"
:set logcontent ("$logcontent
" ."$logcontenttemp")
:set logcontenttemp "\n\r"
:set logcontent ("$logcontent
" ."$logcontenttemp")
:set logcontenttemp "***************************************************************************************"
:set logcontent ("$logcontent
" ."$logcontenttemp")
:set logcontenttemp "KEY: \n\r"
:set logcontent ("$logcontent
" ."$logcontenttemp")
:set logcontenttemp "Should you have any queries, please contact your account manager"
:set logcontent ("$logcontent
" ."$logcontenttemp")
:set logcontenttemp "\n\r"
:set logcontent ("$logcontent
" ."$logcontenttemp")
:set logcontenttemp "Kind Regrads"
:set logcontent ("$logcontent
" ."$logcontenttemp")
/tool e-mail send to=$scriptemail subject="$[/system identity get name] ddns report" body="$logcontent" start-tls=yes
}
:log info "******************** ending - ddns ********************"