Hi, i have this script:
:if ([/ping address=8.8.8.8 count=25]=25) do={
/file set miconexion.txt contents [/system clock get date]
} else={/file set miconexion.txt contents [/system clock get date]}I need line break for each script run like that:
nov/18/2013
nov/18/2013
nov/18/2013
nov/18/2013
And this script only replace the first line for each run..
Hi again guys, i have a little problem with this script, this is the final code:
:if ([/ping address=8.8.8.8 count=4]=4) do={
/file set miconexion.rsc contents ([/file get miconexion.rsc contents] . “\n” . [/system clock get date] . “_” . [/system clock get time] ."_ ". “Conexion”)
} else={/file set miconexion.rsc contents (“\n” . [/system clock get date] . “_” . [/system clock get time] .“_”. “No hay conexion”)}So, i have this script in a scheduler, every 5 seconds for testing, but i dont know why, this script stop writing in the file or it rewrites the file, erasing all before lines wrote, after X seconds.. :S
Maybe the problem is on the else, but i dont find it..
UPDATE: The script usually stops when the file (miconexion.rsc) reached the ±4000B
Yeah, sadly it’s a known issue with RouterOS… The upper limit is really 4096B (or 4KiB).
The only way to keep a larger file is to simply not use scripting to write it and/or store it. Like, you could perhaps use “/tool fetch” to send the results to an FTP or HTTP server, where the contents would be written on a file there.
“But what about when there’s no connection to the server?” I hear you asking. Well, you could keep a file on the router up until the server is reachable, and as soon as the connection is back on, send the file’s contents, and remove it.