Community discussions

MikroTik App
 
VeeDub
just joined
Topic Author
Posts: 10
Joined: Fri Jun 02, 2017 4:11 pm

Wait for command to complete?

Tue Sep 18, 2018 5:35 am

Hello,

I'm sure this question has been asked before, but I can't work out a search that provides relevant results

So I have the following command
{
:execute {ping 10.0.0.1 interface="bridge / LAN" interval="1000ms" count=30} file=ping.txt
}
The ping takes time to execute, is there a way that I can monitor for when the ping has completed, or can I only use some arbitrary delay?

I want to read the file once the ping has completed

Thanks

VW
 
User avatar
rendezz
just joined
Posts: 16
Joined: Mon Sep 17, 2018 11:07 am

Re: Wait for command to complete?

Wed Sep 19, 2018 11:50 am

You could try
{
:execute {   ping 10.0.0.1 interface="bridge / LAN" interval="1000ms" count=30; /file print file=pingdone.txt; } file=ping.txt
}
 
Then in your later code, or other code where you are waiting, just look for the existence of pingdone.txt which will only be created after the ping is complete. This testing can be done with a :len and a find
 
VeeDub
just joined
Topic Author
Posts: 10
Joined: Fri Jun 02, 2017 4:11 pm

Re: Wait for command to complete?

Thu Sep 20, 2018 7:15 am

That works great.

Thanks!

Who is online

Users browsing this forum: No registered users and 30 guests