Global variables are lost

(Sorry about my English, is translated by google.)

I have problem with global variables, once defined, randomly disappear from the environment, I could not find a pattern that I serve as a diagnosis, simply disappear. My platform is a RB450 version V4.3.

Historically there was a problem with global variable that has already been solved, was not reflected these changes if different approaches were modified, (console / script schelude), namely whether it was created by a script could not be change its value via the console and vice versa, I suppose for user rights problems, I assumed that the script ran as root and as the admin console. This was solved but the disappearance in setting global variables is a problem that I think is dragged from earlier versions (v3.2), I discover the circumstances in which it occurs.

Ej
Define a script pair Initialize variables

name=“DefVariables” owner=“admin” … source=
:global EstadoTip1;
:global EstadoTip2;
:global ContadorUP;
:global EstadoTrafico;
:global ContadorPocoTrafico1;
:global ContadorPocoTrafico2;

the minutes of starting the OS to run the script scheluder “DefVariables” if I do a:

[admin@BC] > :environment print

“EstadoTip1”=0
“EstadoTip2”=0
“ContadorUP”=0
“EstadoTrafico”=[:nothing]
“ContadorPocoTrafico1”=0
“ContadorPocoTrafico2”=0
[admin@BC] >

But after the variable minutes or hours away


[admin@BC] > :environment print

[admin@BC] >

Where were … !!!

Does anyone have any idea if it’s a bug or I’m just goofing on something? may be a memory management error, you lose a pointer or something.

thanks

Try this for a test:

:global EstadoTip1 100;
:global EstadoTip2 200;

If you only declare a variable without defining it, I don’t think it stores it.

Whether or not defined, are lost.
That is why I show the example and disappear at any moment. This came up also with several scripts that update dynamic domains on different machines, only I did not realize that causes the MK stops updating the dynamic domain.

I’ve seen this happen if a script crashes.

Ex. If you’re getting an IP for an interface, but it doesn’t have an IP assigned.
If there is some syntax error in your script that causes it to crash.

Run all scripts manually via Terminal or Console and check for any errors.

/system script run <script name>

Also, if you’re storing large (say > 4000 bytes) of data in a variable, this can cause all global variables to disappear.

if i understood you correctly then you have to re-declare variable again for use.

i fin one script you have

{:global lala 7}

then in other script you have to do following

{global lala; :put lala}

Ok thanks,

I think it can be for errors of syntax, that struck me during the testing during the design of the script