Community discussions

MikroTik App
 
IlCarletto
newbie
Topic Author
Posts: 33
Joined: Mon May 10, 2010 3:09 pm
Location: Milan
Contact:

Run Script Randomly

Thu Dec 14, 2017 2:49 am

I at al
I have some script, every script set a different value frequency for an wifi interface
I'd like to run on of the N script, in randomly time es:

random time: script 4
random time: script 3
random time: script 5
random time: script 1
....
Thank you
 
2frogs
Forum Veteran
Forum Veteran
Posts: 713
Joined: Fri Dec 03, 2010 1:38 am

Re: Run Script Randomly

Thu Dec 14, 2017 5:47 am

You might look at this:
viewtopic.php?t=56933
 
User avatar
ADahi
Member Candidate
Member Candidate
Posts: 209
Joined: Thu Sep 21, 2017 7:16 pm
Location: Iraq, Ninavah
Contact:

Re: Run Script Randomly

Thu Dec 14, 2017 9:28 am

try this may help you :wink:
this random numbers with range of 0 to 9
{
:local NofScripts 10;
:local S [/system clock get time]; 
:local rand [:pick $S ([:len $S]-2) [:len $S]];
:log warning ("random number = " . $rand % $NofScripts) 
#:do { /system script run number=($rand % $NofScripts) }
}

Who is online

Users browsing this forum: theredo and 10 guests