CLI glitch

Hello :slight_smile:

There is something that forces the cli to reload the files or the scripts?
Example, if I add a script and immediately execute it, it gives “not found”:

[admin@MikroTik] > /system script print 
Flags: I - invalid 
[admin@MikroTik] > /system script add name=test source=":put hello"
[admin@MikroTik] > /system script run 0
no such item
[admin@MikroTik] >

However if I put a delay of one second between the creation and the execution it works. This also happens with fetch command, I try get the content of the file downloaded but it gives always “not found” until I print the files list.

Thanks.

This is because those are ultimately stored in (and read from) HDD, not RAM.

RouterOS writes to HDD every 1.5 seconds, and everything in the meantime is stored in RAM, and scheduled for the next HDD write. This approach is used for performance - if you need to download not one, but several files (or create not one, but several scripts), the overall time becomes less. The “price” you pay is exactly the thing you’re noticing - you can’t read the files until they’ve been written.

Ok understood… Thanks :slight_smile: