I am new to mikrotik scripting, and trying to create a global variable that will persists throughout the mikrotik. I know global-variables are user-based, so I only use Admin in this case. Here is my script :
Code: Select all
/log info message="gIsReconnecting before: $gIsReconnecting"
:if ( $gIsReconnecting = nil ) do= {
/log info message="gIsReconnecting is empty"
:global gIsReconnecting "yellow"
:set gIsReconnecting "RED"
}
/log info message="gIsReconnecting after: $gIsReconnecting"
Output (after running a few times) :
Code: Select all
gIsReconnecting before:
gIsReconnecting is empty
gIsReconnecting after:
gIsReconnecting before:
gIsReconnecting is empty
gIsReconnecting after:
Problem is the global variable is never set. Am I doing something wrong ?