Are no miss understanding I have a file fw.rsc which I keep my firewall definition in I use it by going import fw.rsc I would like some of those line to be enabled or disabled based on the hostname . Alex -----Original Message----- From: Public [mailto:public-bounces@talk.mikrotik.com.au] On Behalf Of Karl Auer Sent: Sunday, 10 January 2016 11:33 AM To: public@talk.mikrotik.com.au Subject: Re: [MT-AU Public] scripting question On Sat, 2016-01-09 at 22:20 +0000, Alex Samad - Yieldbroker wrote:
I keep a single rsc file for 2 CCR's that have the same firewall rules [...] Is there some way to include some sort if statement where I can go if hostname = rtr1 then include this line instead of having to have 2 files.
Yes. :global hostname [/system identity get name]; :if ( $hostname = "rtr" ) \ do={ :put "hostname is rtr" } \ else={ :put "Hostname is not rtr" } It's all documented on the Mikrotik website - google for "mikrotik scripting manual" or go here: http://wiki.mikrotik.com/wiki/Manual:Scripting Loops and conditionals are described in section 1.8. You might also be interested in the scripting examples here: http://wiki.mikrotik.com/wiki/Manual:Scripting-examples Regards, K. -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Karl Auer (kauer@nullarbor.com.au) work +61 2 64957435 http://www.nullarbor.com.au mobile +61 428 957160 GPG fingerprint: 6D59 8AE6 810D 44E3 7626 7040 4DD6 F89F 3053 4774 Old fingerprint: 9DCA 0903 BCBD 0647 BCCC 2FA7 A35C 57A1 ACF9 00BB _______________________________________________ Public mailing list Public@talk.mikrotik.com.au http://talk.mikrotik.com.au/mailman/listinfo/public_talk.mikrotik.com.au