running script async ?

Hi,
Here is my two test scripts:

#test1
:global iface
:foreach n in=[/interface find type=ovpn-in] do={

:set iface [/interface get $n name]
:log info $iface
/system script run test2
}

#test2
:global iface
:log info $iface
:delay 10

My question is, how do I make it run async, that is the first script not to wait for the second to return before running the next foreach? Because now it waits 10 seconds before each one.

Thanks,
Andras

I accomplish this by calling the script from the scheduler.

Create a scheduled script called “SchScript2” to run at startup that contains one line:

/system script run test2

Now, modify your first script, replacing the above code with:
:local newstarttime ([/system clock get time] + 00:00:01)
/system scheduler set [/system scheduler find name=SchScript2] start-time=$newstarttime

Wow. Just wow. I dont think I would have ever thought of that. Thank you very much :slight_smile: