How to get value if route is enabled?

Hello, I tried this route check script, but of course it is not working :slight_smile:
Can somebody point me in right direction?

Here is what i wrote:

:if (([/ip route find comment=natlut]=enabled)&&( [/ip route find comment=KDS]=enabled)) do={
    /ip route enable [/ip route find comment=prhinasve];
} else={
    /ip route disable [/ip route find comment=prhinasve];
}

Thanks.

First of all, there’s no “enabled” for routes - there is !disabled, though. Secondly, you can’t compare to that either. You have to find the routes by attributes and then check if anything is returned.

This should work:

:if (([:len [/ip route find where comment="natlut" and !disabled]] > 0) and ([:len [/ip route find where comment="KDS" and !disabled]] > 0)) do={
	/ip route { enable [find comment="prhinasve"]};
} else={
	/ip route { disable [find comment="prhinasve"]};	
}

However that doesn’t seem like something you’d normally want to do. Maybe you could solve this by using recursive routes instead? What are you trying to achieve?