Community discussions

MikroTik App
 
sergeda
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 78
Joined: Wed Sep 20, 2006 6:03 am

Script works fine on 3.30 but fails on 4.17

Mon Aug 15, 2011 3:08 pm

Hi all.
We use this script to connect remote offices to main office even if main link in main office down.
This script working fine on 3.30 but on 4.17 it fails and highlighting equals sign in red.
I can't find what wrong.
Can somebodey help me with this?


:if ([/ping [/interface l2tp-client get office_main connect-to] count=10]<3) do={:global s1 "na"; interface
l2tp-client monitor [find name="office_backup"] once do={:set s1 $status}; :if ($s1="disabled") do={:log info "Main
vpn link down, will try to switch to backup one."; :if ([/ping [/interface l2tp-client get office_backup connect-to]
count=10]>5) do={:log info "We can ping backup interface, going to use it"; /interface l2tp-client disable [find
name=office_main]; interface l2tp-client enable [find name=office_backup]} else={:log info "We can't ping backup
interface, just waiting"}}} else={:global s "na"; interface l2tp-client monitor [find name="office_backup"] once
do={:set s $status}; :if ($s!="disabled") do={:log info "Main link up, going to connect vpn"; /interface l2tp-client
disable [find name=office_backup]; interface l2tp-client enable [find name=office_main]}}
 
User avatar
janisk
MikroTik Support
MikroTik Support
Posts: 6263
Joined: Tue Feb 14, 2006 9:46 am
Location: Riga, Latvia

Re: Script works fine on 3.30 but fails on 4.17

Mon Aug 15, 2011 4:26 pm

open in winbox new terminal, or simple login through ssh or telnet, open your script in there, like, /system script edit myscript source and using F5 key refresh the highlighting. Where highlighting stops most probably you have an error, since scripting was updated from 3.x to 4.x
 
sergeda
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 78
Joined: Wed Sep 20, 2006 6:03 am

Re: Script works fine on 3.30 but fails on 4.17

Mon Aug 15, 2011 5:08 pm

open in winbox new terminal, or simple login through ssh or telnet, open your script in there, like, /system script edit myscript source and using F5 key refresh the highlighting. Where highlighting stops most probably you have an error, since scripting was updated from 3.x to 4.x
Thank you but this doesn't help. When in edit mode it highglight equals sign in red also. If I delete equals sign and type it again, no red highghlight in edit mode but after save doing scripts print shows this equals sign in red again. I can't understand what the problem with it.
 
User avatar
janisk
MikroTik Support
MikroTik Support
Posts: 6263
Joined: Tue Feb 14, 2006 9:46 am
Location: Riga, Latvia

Re: Script works fine on 3.30 but fails on 4.17

Tue Aug 16, 2011 9:01 am

you can look here:
http://wiki.mikrotik.com/wiki/Scripting

and look some scripting examples on the wiki or forums for RouterOS 4.x

That red means syntax error, some extra space or something.
 
sergeda
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 78
Joined: Wed Sep 20, 2006 6:03 am

Re: Script works fine on 3.30 but fails on 4.17

Tue Aug 16, 2011 10:39 am

you can look here:
http://wiki.mikrotik.com/wiki/Scripting

and look some scripting examples on the wiki or forums for RouterOS 4.x

That red means syntax error, some extra space or something.
Thank you.
But where can I find info about diffrences in script language between 3.30 and 4.17?