Page 1 of 1
Scripts won't run
Posted: Fri Mar 23, 2007 11:08 am
by IceDiamond
None of my scripts will execute, even the simple ones. When I click the Run Script button (or execute the command using the terminal) nothing happens. No error, no execution, nothing.
What is causing this?
Posted: Fri Mar 23, 2007 11:16 am
by normis
what version of RouterOS are you running, and also please show us one of your simple scripts.
Posted: Fri Mar 23, 2007 11:20 am
by mrz
Could you be so kind and post script that isn't working?
Posted: Sat Mar 24, 2007 10:10 am
by RedHat
maybe ur scripts rights as a command .. but there is no thing to do it !!
pleaes tell us what the script wirung for .. ans what is the script
![Question :?:](./images/smilies/icon_question.gif)
Scripts won't run: Examples
Posted: Mon Mar 26, 2007 11:03 am
by IceDiamond
DynamicIP Script
--------------------
:log info "Dynamic IP Update Via Mail: Begin"
:global dip-interface "I-Burst"
:global dip-ip [ /ip address get [/ip address find interface=$dip-interface] address ]
:if ([ :typeof $dip-lastip ] = nil ) do={ :global dip-lastip 0.0.0.0/0 }
:if ([ :typeof $dip-ip ] = nil ) do={
:log info ("Dynamic IP Update Via Mail: No ip address present on " . $dip-interface . ", please check.")
} else={
:if ($dip-ip != $dip-lastip) do={
:log info "Dynamic IP Update Via Mail: Attempting to Send Updated IP ". $dip-ip
/tool e-mail send to="ip@internetguy.co.za" body=$dip-ip subject=([/system identity get name] . " New IP Address " . $dip-ip)
:log info "Dynamic IP Update Via Mail: Sending UPDATE!"
:global dip-lastip $dip-ip
} else={
:log info "Dynamic IP Update Via Mail: No change"
}
}
:log info "Dynamic IP Update Via Mail: End"
----------------------------------------------------------------------------------
Script2
--------
I attempted to run the following one line command, again nothing happens when I execute a command or click the button, to run the script. There is also no log messages.
/tool e-mail send to="ip@internetguy.co.za" body=$dip-ip subject=([/system identity get name] . " New IP Address " . $dip-ip)
----------------------------------------------------------------------------------
Strangely enough, I wrote a new script this morning to add a user and it runs.
/ tool user-manager user
add subscriber=Justin name="Test" password="test" first-name="Justin" \
last-name="Minnaar" phone="011 849 5336" location="Howick Gardens #56" \
email="Test@Region.co.za" download-limit=100000000 \
upload-limit=100000000 comment="Test account with 100k up and 100k down" disabled=no
---------------------------------------------------------------------------------
Any advice would be appreciated.
Posted: Mon Mar 26, 2007 10:08 pm
by changeip
:log info "Dynamic IP Update Via Mail: Attempting to Send Updated IP ". $dip-ip
the above line is incorrect. Put ( ) around the text so it evaluates the statement.
Sam
Pity that the router's compiler does not log a compiler erro
Posted: Tue Apr 03, 2007 8:25 am
by IceDiamond
Thank you for your help. I have resolved the problem by deleting the offending line. I could not get ( ) around the string . string to work correctly and figured I would probably have to create a local variable but it was not neccessary. Anyway, the script runs now successfully! Funny enough, other lines have ( ) for logging info and work fine.
Posted: Tue Apr 03, 2007 10:45 am
by mrz
correct code would be:
:log info ( "Dynamic IP Update Via Mail: Attempting to Send Updated IP " . $dip-ip )
and it works.
Re: Scripts won't run
Posted: Fri Sep 09, 2011 12:31 pm
by ZioN
Has anyone yet made an attempt at writing a basic syntax compiler for MT Scripts?
Or is MT Scripts based on a scripting language that has a compiler. Even if it wont compile completely, but just check the syntax symbols?
Re: Scripts won't run
Posted: Fri Sep 09, 2011 12:34 pm
by mrz
Syntax "compiler" is already built in.
Write a script and if there are any syntax errors
/system script print will highlight them.
Re: Scripts won't run
Posted: Sat Sep 10, 2011 2:51 am
by tjc
I think the request was for an external syntax checker with diagnostics. That would definitely be a very useful tool.
Re: Scripts won't run
Posted: Mon Sep 12, 2011 11:25 pm
by ZioN
That would definitely be a very useful tool.
Yip. That would be great! Some form of a tool to guide you in the right direction when debugging. I sat once for 3 hours staring at a uncompilable script just to find a simple math error.
Has there been attempts at producing such a tool?