Traffic Monitor script problem

I am using this script with traffic monitor. The warning appears in the logs but when triggered the mangle rule is not changed. Can anyone see what I am doing wrong?

:if ( $duration = 30s ) do={
/ip firewall mangle set (find comment=“Load-Balancing here”) new-routing-mark=wan2_rout
}
:log warning “FO Debug: wan1 Failed, switching to wan2”

Thanks In Advance

Use full syntax when writing script, and you make less mistake…

:if ($duration="30s") do={
/ip firewall mangle set [/ip firewall mangle find where comment="Load-Balancing here"] new-routing-mark="wan2_rout";
};
:log warning message="FO Debug: wan1 Failed, switching to wan2";

Thanks for the reply rextended. Yes you are right. Made the changes but still no dice.

I use similar traffic monitor script with my bandwidth based load balancing and have no problems.

mon1
:log warning “LB Debug: wan1 overloaded, switching to wan2”
/ip firewall mangle set [find comment=“Load-Balancing here”] new-routing-mark=wan2_rout

mon2
:log warning “LB Debug: wan1 back to normal”
/ip firewall mangle set [find comment=“Load-Balancing here”] new-routing-mark=wan1_rout

The code I have (re)write is working if all the rest of the script and the mangle are right…

I have fix only the errors, not checked if the logic are right.


the key is on “$duration”, how this variable are set?

Thanks for the info but the issue is between the chair and keyboard. I am a complete noob with scripting and this is the first experience with Conditional statement scripts. I am not looking for anybody to do this for me but maybe a bit more direction.

Thanks in advance