Community discussions

MikroTik App
 
rviteri
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 84
Joined: Fri Nov 18, 2011 5:53 pm

Script failing after running for a while

Mon May 14, 2018 5:56 am

Hello!

I am running a script on boot that is an infinite loop. For some reason the script stops running after a while (it no long is listed as a job) - maybe around 30 minutes to an hour after being up. Can someone help me see what's going on? BTW this used to work great before.
I am running version 6.42.1 on a RB2011UAS-2HnD
:local conn [/ip firewall mangle find comment="LoL connetion mark as gaming"]; 
:local connvoip [/ip firewall mangle find comment="voip-in packet mark RTP"]; 
:local count1 [/ip firewall mangle get value-name=packets $conn ]; 
:local count1voip [/ip firewall mangle get value-name=packets $connvoip ]; 
:local count2 [/ip firewall mangle get value-name=packets $conn ]; 
:local count2voip [/ip firewall mangle get value-name=packets $connvoip ];
:local wait 2;
#:local rate ((($count2 + $count2voip) - ($count1 + $count1voip)) / $wait );
:local status; 
:set status [ /queue tree get in disabled ];
:local status2;
:set status2 [ /queue tree get out disabled ];


:while ( ((($count2 + $count2voip) - ($count1 + $count1voip)) / $wait ) <= 5 ) do={

:set count1 [/ip firewall mangle get value-name=packets $conn ]; 
:set count1voip [/ip firewall mangle get value-name=packets $connvoip ]; 
:delay $wait; 
:set count2 [/ip firewall mangle get value-name=packets $conn ]; 
:set count2voip [/ip firewall mangle get value-name=packets $connvoip ];
:put ((($count2 + $count2voip) - ($count1 + $count1voip)) / $wait );

:while ( ((($count2 + $count2voip) - ($count1 + $count1voip)) / $wait ) > 5 ) do={


:if ($status || $status2 = true) do={

/queue tree enable in;
/queue tree enable out;
:set status false;
:set status2 false;
:log info "Queue Activated";
}

:set count1 [/ip firewall mangle get value-name=packets $conn ]; 
:set count1voip [/ip firewall mangle get value-name=packets $connvoip ]; 
:delay $wait; 
:set count2 [/ip firewall mangle get value-name=packets $conn ]; 
:set count2voip [/ip firewall mangle get value-name=packets $connvoip ];


};



:delay $wait;

:if ($status = false ) do={
/queue tree disable in;
/queue tree disable out;
:set status true;
:set status2 true;
:log info "Queue Deactivated";


}

};

Who is online

Users browsing this forum: jamrobe, megabitus, MSN [Bot] and 16 guests