Ben's notes

Linux, Unix, network, radio...

User Tools

Site Tools


routeros_bogon_update

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
routeros_bogon_update [2015/04/19 11:44] – [RouterOS 6.x - Update bogon list automatically] adminrouteros_bogon_update [2015/04/19 11:58] – [RouterOS 6.x - Update bogon list automatically] admin
Line 14: Line 14:
 /ip firewall address-list remove [/ip firewall address-list find list=bogons] /ip firewall address-list remove [/ip firewall address-list find list=bogons]
  
-:local content [/file get [/file find name=bogon-bn-agg.txt] contents] ; +:global content [/file get [/file find name=bogon-bn-agg.txt] contents] ; 
-:local contentLen [:len $content];+:global contentLen [:len $content];
  
-:local lineEnd 0; +:global lineEnd 0; 
-:local line ""; +:global line ""; 
-:local lastEnd 0;+:global lastEnd 0;
  
 :log info "Adding bogons from file."  :log info "Adding bogons from file." 
Line 30: Line 30:
    :set lastEnd ($lineEnd + 1);    :set lastEnd ($lineEnd + 1);
        
-   :if ($line != "\r") do={+   :if ($line != "\n") do={
       /ip firewall address-list add list=bogons address="$line"       /ip firewall address-list add list=bogons address="$line"
    }    }
 }</code> }</code>
   * Test run script:<code>/system script run bogons</code>   * Test run script:<code>/system script run bogons</code>
-  * Schedule script:<code>[admin@MikroTik] /system scheduler add name=update-bogons interval=24h start-time=7:00:00</code>+  * Schedule script:<code>/system scheduler add interval=24h start-time=7:00:00 on-event=bogons name=update-bogons</code>
  
routeros_bogon_update.txt · Last modified: 2021/10/31 14:40 by admin