Code: Select all
:delay 15m
:global stopRouterRun
:global now
:local filenameIP "iphistory.txt"
:do {
/file
:if ([:len [find where name="flash" and type="disk"]] = 1) do={:set filenameIP "flash/$filenameIP"}
:if ([:len [find where name=$filenameIP]] = 0) do={print file="$filenameIP"; :delay 5s; set $filenameIP contents=""}
:global currentIP
:local newIP [/ip address get [find interface="ETHERT 1"] address]
:set newIP [:pick $newIP 0 [:find $newIP "/" -1]]
:if ($newIP != $currentIP) do={
/file
:delay 5s
:local filecontent [get $filenameIP contents]
:local newfilecontent "********************************************************************\r\nNEW IP: $newIP\t$now\r\n$filecontent"
set $filenameIP contents=$newfilecontent
:set currentIP $newIP
}
:delay 10s
} while=(!$stopRouterRun)
EL DONCITO.