Community discussions

MikroTik App
 
CerpinTaxt
just joined
Topic Author
Posts: 5
Joined: Wed Mar 01, 2017 3:12 am

Running a script from a script

Fri Sep 08, 2017 3:21 am

I have come across what I would describe as a bug with RouterOS scripting.

Given the two scripts created by:
/system script
add name=first owner=admin policy=\
    ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source=\
    "/system script run second"
add name=second owner=admin policy=\
    ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source=\
    ":log info \"two ran\""
You can run the script "one" and it will in turn run the script "two" and you get a log entry.

Compare this with the scripts created by:
/system script
add name=third owner=admin policy=\
    ftp,reboot,read,write,policy,test,password,sniff,sensitive source=\
    "/system script run fourth"
add name=fourth owner=admin policy=\
    ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source=\
    ":log info \"fourth ran\""
Now, running "third" will not run "fourth" and no log entry is generated. The only difference (aside from the names of the scripts) is that in the first example, the policy box for 'romon' is unticked.

I would love to know how Romon is related to a script running another script? Is this indeed a bug?

EDIT: I did check the documentation at https://wiki.mikrotik.com/wiki/Manual:Scripting, and followed the link provided to https://wiki.mikrotik.com/wiki/Manual:R ... Properties where I note there is no actual entry for romon to describe it's purpose here.

EDIT2: Turns out it's not romon-specific, it's just that the permission level of the parent script must be higher or equal to that of the child, however I still argue it's still an undocumented anomaly and has caused me a week of headaches.
 
User avatar
ahmedalmi
Frequent Visitor
Frequent Visitor
Posts: 75
Joined: Sat Sep 13, 2014 5:52 pm
Location: sana'a yemen
Contact:

Re: Running a script from a script

Mon Sep 18, 2017 6:36 pm

you just remove romon from fourth script
and it will run.
your script will be like this

Code: Select all

/system script
add name=third owner=admin policy=\
ftp,reboot,read,write,policy,test,password,sniff,sensitive source=\
"/system script run fourth"
add name=fourth owner=admin policy=\
ftp,reboot,read,write,policy,test,password,sniff,sensitive source=\
":log info \"fourth ran\""
or add romon in third script
and it will be like

Code: Select all

/system script
add name=third owner=admin policy=\
ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source=\
"/system script run fourth"
add name=fourth owner=admin policy=\
ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source=\
":log info \"fourth ran\""