Reading threads here led to skipping right past the RESOLVE command to "/ip firewall address-list add address=[FQDN] list=[list-name]
This seemed to work great except it would not run a second time (only the first time).
I then found a thread that explains that if the FQDN exists, the "/ip firewall address-list add..." command produces an error (which halts the script).
I then went searching for a parameter to force an update, but found that this does not exist.
Am I down the right path?
All I want is a regular (every few days or week) updated list of domain names and their corresponding IP addresses.
Here is the script that I have:
When there does not exist any addresses in the list "locations" and I run this script, the addresses are added to the list "locations" and the file is FTP'd to my FTP server.
Code: Select all
/ip firewall address-list add address=xxxxx.dyndns.org list=locations /ip firewall address-list add address=yyyyyy.dyndns.org list=locations /ip firewall address-list add address=zzzzz.dyndns.org list=locations /system :local cdate [clock get date] :local yyyy [:pick $cdate 0 4] :local MM [:pick $cdate 5 7] :local dd [:pick $cdate 8 10] /ip firewall address-list print file="$[$cdate]-dns-locations" where list=locations /tool fetch upload=yes mode=ftp ascii=no src-path="/$[$cdate]-dns-locations.txt" dst-path="/mikrotik-backups/$[$cdate]-dns-locations.txt" address=192.168.2.22 port=21 user=mikrotik password=mikrotik /file remove "$[$cdate]-dns-locations.txt"
Subsequent executions of the script (that is, once the list "locations" has entries) fails.