Any know how to retain variables's values after reboot the MT, saving this values to disk ?
-Roddy
:global persist do={
:local varName $1
:local varValue $2
:local varID [/ip firewall layer7-protocol find name="$varName"]
:if ([:typeof $varValue] = "nothing") do={
:if ($varID != "") do={
:set $varValue [/ip firewall layer7-protocol get $varID value-name=regexp]
}
} else={
:if ($varID = "") do={
/ip firewall layer7-protocol add name="$varName" regexp="$varValue"
} else={
/ip firewall layer7-protocol set $varID regexp="$varValue"
}
}
return $varValue
}
Did not see that before.
Why in the earth does not the RuterOS retains the global variable after reboot.
This should be a simple ting for MT to implement???
So MT consider this as a request.
I am sorry to say but half of the forum is using L7 as variables.Write variables in scheduler startup script is a better option than writing variables in l7 rules and other crazy stuff.
Write variables in scheduler startup script is a better option than writing variables in l7 rules and other crazy stuff.
Can we have a scheduler restart/shutdown then?Write variables in scheduler startup script is a better option than writing variables in l7 rules and other crazy stuff.
Can you show any other scripting language or programming language where defined variables magically restores their values from previous script instance, without saving data to file, registry or database? If you want to save something handle it in your code.Why in the earth does not the RuterOS retains the global variable after reboot.
With L7 is the same as with scheduler configuration you have to write changes. If you do not write latest changes to scheduler or even your used L7 then of course nothing is saved.
- But... what with rapid power-off... data will be lost !
L7 stay with latest one value ever reboot.
I understand you, what ever it's stored, persistent env are know stuff and we can use them like `setx /M path "%path%;C:\your\path\here\"`With L7 is the same as with scheduler configuration you have to write changes. If you do not write latest changes to scheduler or even your used L7 then of course nothing is saved.
Benefit of using startup scheduler is that you do not need to read and parse variables, they are just loaded at startup automatically.
That is not important. From my time with MT Router this has been something that many of us like to have. Yes there are several workaround File/Script/L7 etc, but why not implement it? Should be easy to do. Look at Larsas post above..Can you show any other scripting language or programming language where defined variables magically restores their values from previous script instance, without saving data to file, registry or database? If you want to save something handle it in your code.
Can you show any other scripting language or programming language where defined variables magically restores their values from previous script instance, without saving data to file, registry or database? If you want to save something handle it in your code.
+1See this post as an formal request for presistant variables.