That is awsome news.
Are you willing to share a working script so i could accomplish that task, i would really appreciate it.
I've been trying to import, export and download files using mikrotik script's, but i'm not getting the job done. I belive that it would be easier to have a central manual file that i can edit, and then the devices can get that file a run the script to apply the changes. But it would be really awesome to get my central system to export the necessary content and upload it to my ftp server, and the procede with the rest of the process. Best regards, Paulo Brinca.
Try this:
Create a file name data.txt, add entries you want something like this.
data.txt example contents ...
aacable.wordpress.com
yahoo.com
google.com
cnn.com
bbc.com
Make sure you don't add any space at the end of the line or any empty line.
Upload this data.txt to your central FTP server files section.
Now create a script on all your hotspot routers, the script will fetch a file name data.txt from your central FTP server and will parse it and add entries to your hotspot walled garden ip list. You can schedule the script to run on Daily basis.
Tested with ROS 5.20
# January 3rd, 2014
# Script Started .... Syed Jahanzaib / aacable @ hotmail . com
# Printing local time for Log purposes ...
:local CurrentTime [/system clock get time];
:log warning "Script Start to Update HOTSPOT WALLED ip garden at Current Time = $CurrentTime. . ."
# Downloading / Fetching the Walled Garden List from centgral FTP Server ...
/tool fetch url=http://yourdomain.com/files/data.txt
# Removing any Previous Entries to avoid duplication , using comments detection ...
:foreach entry in=[/ip hotspot walled-garden ip find comment=allowed-walled-garden-domains] do={
/ip hotspot walled-garden ip remove $entry
}
:if ( [/file get [/file find name=data.txt] size] > 0 ) do={
# Parsing data.txt for URLS to be added later in HS Walled Garden
:global content [/file get [/file find name=data.txt] contents] ;
:global contentLen [ :len $content ] ;
:global lineEnd 0;
:global line "";
:global lastEnd 0;
:do {
:set lineEnd [:find $content "\n" $lastEnd ] ;
:set line [:pick $content $lastEnd $lineEnd] ;
:set lastEnd ( $lineEnd + 1 ) ;
# ignore lines which have hash sign in start of line , comment out.
:if ( [:pick $line 0 1] != "#" ) do={
:local entry [:pick $line 0 ($lineEnd -1) ]
:if ( [:len $entry ] > 0 ) do={
# Adding Entries in Walled Garden IP list from the parsed data
/ip hotspot walled-garden ip add action=accept disabled=no dst-host="$entry" comment=allowed-walled-garden-domains;
}
}
} while ($lineEnd < $contentLen)
}
:log warning "Script Completed ... at Current Time = $CurrentTime . . . Jz"
# Script Completed ....