Community discussions

MikroTik App
 
telepro
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 66
Joined: Sun Apr 03, 2011 7:50 pm

changed script operation in 6.1?

Mon Jun 17, 2013 4:27 pm

Has script processing changed in 6.1 from 6.0

This script, called demo1.rsc, copied to the files directory, and executed with an import command:

# This is a comment
:local xyz "xx123";
# Three previously acceptable lines
:log info ("----- Config admin password to $xyz")
/user set admin password=$xyz;
/user set admin password="$xyz";


This file previously worked in 6.0 and prior releases, but now produces the following:

[admin@MikroTik] > import file=demo61.rsc
#line 1
# This is a comment
#line 2
:local xyz "xx123";
#line 3
# Three previously acceptable lines
#line 4
:log info ("----- Config admin password to $xyz")
syntax error (line 1 column 45)
[admin@MikroTik] >

1. The individual lines are copied to the console
2. The comment lines are output in reverse video
3. the expansion of local variables now produces a syntax error

Perhaps i missed some additional documentation on changes to script processing? if so, can someone point me to it?
thanks in advance.
 
User avatar
janisk
MikroTik Support
MikroTik Support
Posts: 6283
Joined: Tue Feb 14, 2006 9:46 am
Location: Riga, Latvia

Re: changed script operation in 6.1?

Tue Jun 18, 2013 5:15 pm

if you write "script" in command line then you have to surround this script with curly braces as each command in CLI is separate script.

so
{:local lala;
:set lala aaa;             
:put $lala
}
this is how it should work
 
telepro
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 66
Joined: Sun Apr 03, 2011 7:50 pm

Re: changed script operation in 6.1?

Tue Jun 18, 2013 5:44 pm

Thanks for the reply.
i understand that files entered at the command line require braces surrounding the script.

This problem was not a script entered from the command line.
The script was created as a file and was composed on a windows system.
We then started winbox, and used drag and drop to place it in the files window in winbox
it was stored as a file named demo61.rsc
It was then executed with a command line on a winbox terminal session as follows:

[admin@MikroTik] > import file=demo61.rsc

That execution produced the errors indicated above.

If the braces are added to the text in the file as you suggest:

{
# This is a comment
:local xyz "xx123";
# Three previously acceptable lines
:log info ("----- Config admin password to $xyz")
/user set admin password=$xyz;
/user set admin password="$xyz";
}

and the file is drag and dropped to the winbox file window , and then executed with an "import file=demo16.rsc", the following is the response:

[admin@MikroTik] >
[admin@MikroTik] >
[admin@MikroTik] > import file=demo61.rsc
incomplete input: {
[admin@MikroTik] >

This test demo61.rsc file is a demonstration script. This was originally found in a script that does run on versions 6.0 and prior, but does no longer run on 6.1.

thanks
 
dada
Member Candidate
Member Candidate
Posts: 245
Joined: Tue Feb 21, 2006 1:44 pm

Re: changed script operation in 6.1?

Wed Jun 19, 2013 10:20 am

I have ran into this problem recently too.
For years we are configuring our client MT boxes using a perl scripts which creates a configuration using settings stored in database and then another scripts uploads the configuration to the MT box using scp and them runs '/import cfgfile.rsc' on the routerboard. Since 6.1 this is not working because the lines in the script are imported (executed) one by one so defined local variables etc are not visible for subsequent lines (and the contant of lineis printed which is confusing and unwanted because I want to see my own printed (:put) texts from the script).
Since our config script is rather long using {} is not effective - it causes the RB2011 runs in 100% CPU usage for several minutes before doing anything (perhaps analysing all the lines and printing them).

Maris from support@mikrotik.com told me that they will try to do something in the next version. I hope they really will. In other case we should find another way how to configure the devices. We can use '/system script' probably but it looks like creating the scripts from outside of the device is more complicated than using SCP to copy a file.
 
Russian
just joined
Posts: 9
Joined: Wed Jun 12, 2013 10:03 pm
Location: South Africa
Contact:

Re: changed script operation in 6.1?

Mon Jun 24, 2013 6:21 pm

Hi,

I also posted about this problem but in a different section.

http://forum.mikrotik.com/viewtopic.php ... 50#p373562

I hope they can make an option to make it verbose or not as we do also not want it run in cml.
 
eigenstate
just joined
Posts: 6
Joined: Sat Dec 01, 2012 12:33 am

Re: changed script operation in 6.1?

Tue Jul 09, 2013 1:37 am

This is a critical problem for us. We rely on very elaborate scripts—amassed over years of development—to dovetail with native C++ application software we build for our customers. In many cases, these RouterOS scripts write out text whose purpose is to write out yet more escaped text that gets interpreted as imported or scheduled script; that's three levels of abstraction just within the RouterOS domain. Yet with all this complexity, our company has maintained backward compatibility since ROS 3.24 despite MikroTik's countless undisclosed changes to the way scripts are handled by RouterOS.

But this major scripting change in 6.1 is an absolute game-changer for us. If these issues are not resolved to be backward compatible with existing scripts, our company will have no alternative but to move to another platform; it’s just not practical for us to rewrite and debug countless lines of multiply escaped strings and chop large scripts into difficult-to-manage sub-units.

As a company, MTik has long demonstrated what might be considered a careless regard for the stability of existing user scripts and config settings, changing what they will, often without corresponding change-log entries. Because MTik products are innovative and affordable, we utilize them in large volume in our business products, but we simply cannot scrap our existing script libraries to accommodate the new changes.

I wonder how many other users will be experiencing the same problems addressed in this post topic but with no prior warning. Once all users’ scripts stop working, I can only imagine the ensuing Support nightmare and the resultant backlash against using RouterOS.
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 6043
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: changed script operation in 6.1?

Tue Jul 09, 2013 1:44 pm

dada already mentioned, bugs are reported and will be fixed in the future versions.

Who is online

Users browsing this forum: Baidu [Spider], eworm, ivicask, merlinthemagic7 and 59 guests