No such item, select by name, by number

Hello,

I have problem with netwatch script.
I have

/interface ovpn-client enable 0 #on up
/interface ovpn-client disable 0 #on down

I tried to use select by name too. But both work always only while I’m testing it(some minutes). And when I login to mikrotik next day, there are errors “no such item” and client is still on.


ROS 6.0rc6

Thanks for help.

How are you targeting the name?
/interface ovpn-client disable [find name=“ovpn-out1”]
or
/interface ovpn-client disable ovpn-out1I would think either one would work… but you could test one or the other and see if it makes a difference.

I tried
/interface ovpn-client disable ovpn-out1With this code, there was the most errors(after day), it was working while I was logged in on Mikrotik.
With my code in first post, there are some errors.

I will try your first line code.

when you run script environment has no internal temporary numbering available, hence, you get the error. you have to do print command and then that “internal and temporary” numbering is created and can be used.

Or you have to get the name of the interface to access it.

please see wiki.mikrotik.com for more details.

p.s.

{/interface ovpn-client print; /interface ovpn-client disable 0} will work due to curly braces sets environment of script.