Script text runs on Terminal , but not from "run script"

I am trying to run a script that checks a global variable then does a command…

The variable is set by another script that runs OK.

And the variable is visible in the Env window …

If I copy and paste the text to the command line it runs…and updates the log.

Hit the run script button and it doesn’t.

:if ($sysmanping=0) do={  :log info "test ok" }
#

What am I doing wrong?

I would have to quess that the :if command is not in the right place to run from the script button…I dont know…

I am learning this , one line at time, and have tried many variations of the above code …and only get it to run from a copy and paste to the terminal.

Netwatch and scheduler scripts are executed by ‘sys’ special user and do not have access to variables defined by other router users.
This bug is known and not fixed for year, I reported this to MT on 5th December 2011 :frowning:
Try to define and initialize variables for scripts, using script which is executed by scheduler at ‘startup’.

HTH,

Try this:

:global sysmanping
:if ($sysmanping=0) do={ :log info “test ok” }