Hi Okay for completeness Tried removing the : from global NOP Tried placing a :put in the IF statement - it fired so not the if statements Add the :globals at the top and it started to work. Which is strange - cause it doesn't match up with the doco ... global should be global for the script ! Any way I have my answer Thanks Alex -----Original Message----- From: Public [mailto:public-bounces@talk.mikrotik.com.au] On Behalf Of Mike Everest Sent: Tuesday, 7 February 2017 11:53 AM To: 'MikroTik Australia Public List' <public@talk.mikrotik.com.au> Subject: Re: [MT-AU Public] scripting Hi Alex, You don't need ':' for 'global' statement :) Try pasting into the shell first to check operation. Cheers, Mike.
-----Original Message----- From: Public [mailto:public-bounces@talk.mikrotik.com.au] On Behalf Of Alex Samad - Yieldbroker Sent: Tuesday, 7 February 2017 11:31 AM To: MikroTik Australia Public List <public@talk.mikrotik.com.au> Subject: [MT-AU Public] scripting
Hi
I have this I a test.rsc file which I scp over and then I do
/import test.rsc
But it doesn't print anything for the variable
# set local hostname :global hostname [/system identity get name]
:if ( $hostname = "artr1" ) \ do={ :global LocalIP 192.168.0.1 :global ManagementIP 1.3.8.72 :global PublicIP 2.7.3.67 :global PrivateIP 1.3.200.10 :global RouterID 1.3.255.10 }
:if ( $hostname = "artr2" ) \ do={ :global LocalIP 192.168.0.2 :global ManagementIP 1.3.8.73 :global PublicIP 2.7.3.68 :global PrivateIP 1.3.200.11 :global RouterID 1.3.255.11 }
:if ( $hostname = "bextrtr1" ) \ do={ :global LocalIP 192.168.0.1 :global ManagementIP 1.3.8.70 :global PublicIP 2.7.3.69 :global PrivateIP 1.3.200.12 :global RouterID 1.3.255.12 }
:if ( $hostname = "bextrtr2" ) \ do={ :global LocalIP 192.168.0.2 :global ManagementIP 1.3.8.71 :global PublicIP 2.7.3.70 :global PrivateIP 1.3.200.13 :global RouterID 1.3.255.13 }
# vrrp dgw :global PublicVRRPIP 2.7.3.71
# # Validate variables # :put "Hostname: $hostname"
:put "Local IP: $LocalIP" :put "Management IP: $ManagementIP" :put "Public IP: $PublicIP" :put "Private IP: $PrivateIP" :put "Routerid: $RouterID"
_______________________________________________ Public mailing list Public@talk.mikrotik.com.au http://talk.mikrotik.com.au/mailman/listinfo/public_talk.mikrotik.com.au
_______________________________________________ Public mailing list Public@talk.mikrotik.com.au http://talk.mikrotik.com.au/mailman/listinfo/public_talk.mikrotik.com.au -- Message protected by MailGuard: e-mail anti-virus, anti-spam and content filtering.http://www.mailguard.com.au/mg Click here to report this message as spam: https://console.mailguard.com.au/ras/1QdrTdsMhO/5Jeen5FubnSBTggFWs6ceh/0.4