randomly runned autoupgrade script

Hi there,

I have a little question: can a script be run randomly in a mikrotik box?
What I meant is, we want to script all our CPEs with a auto ROS upgrade but we don’t want 4000 CPEs to download in the same time a 10M file from the same FTP server, this will overload the network. We want this randomly done, but automatic. :slight_smile:

can anyone give me a idea?

steven

4000 cpes auto upgrade ? I hope you have checked the upgrade first :wink:

there is no random generator in the scripting language, so you are stuck with schedule I guess, or by api..

Maybe grab some value such as seconds passed since the last full hour of uptime, multiply by ten, and delay the auto-update script by that many seconds. Over 4000 devices you should have a fairly even distribution over 3600 possible values, I would think. It’s only pseudo-random but might work in your situation where you have lots of devices picking from a limited number of states.

:local uptime [/system resource get uptime]; :local length [:len $uptime]; :put (([:pick $uptime ($length - 5) ($length - 3)] * 60) + [:pick $uptime ($length - 1) $length])

Felix

cheers for that mate, I’ll give a try and let you know.

Steven