Community discussions

MUM Europe 2020
 
CoollerM
just joined
Topic Author
Posts: 5
Joined: Tue Oct 11, 2016 2:40 pm

Please help me

Tue Oct 11, 2016 3:06 pm

Hello. I want to use in routes Active flag for building logic.
Example:
:if ([ip route get [find gateway=8.8.4.4 and static and active]])=true :do ......
This command is active if a route it back, but if not then returns No such item.
How to do this the true or false?
 
User avatar
boen_robot
Forum Guru
Forum Guru
Posts: 2411
Joined: Thu Aug 31, 2006 4:43 pm
Location: europe://Bulgaria/Plovdiv

Re: Please help me

Tue Oct 11, 2016 4:15 pm

Try:
:if ([:len [ip route find gateway=8.8.4.4 and static and active]] > 0) do={
#code here
}
PEAR2_Net_RouterOS(1.0.0b6) - My API client in PHP
(Rate my posts? If you want... no pressure...)
 
User avatar
che
Frequent Visitor
Frequent Visitor
Posts: 94
Joined: Fri Oct 07, 2005 1:04 pm

Re: Please help me

Tue Oct 11, 2016 4:34 pm

:local getState [/ip route get value-name=active [/ip route find where gateway=8.8.4.4 and static=yes]]

:if ($getState = true) do {
	SCRIPT WHEN ROUTE IS PRESENT AND ACTIVE
}

:if ($getState = false) do {
	SCRIPT WHEN ROUTE IS PRESENT BUT NOT ACTIVE
}

:if ($getState = "nothing") do {
	SCRIPT WHEN THERE IS NO ROUTE
}

Who is online

Users browsing this forum: No registered users and 20 guests