reset run-count in /system scripts

Hello

I have script which runs itself every 2 seconds and checks something. Of course it increases the run count by couple thousands a half-day. Is there a way to reset it? i can’t manage it by issuing set (number from print) run-count=0 says that there’s no run-count argument. I have RouterOS 2.9. What will happen after a month when run-count will be millions?
I’m sure it can hang MT, especially if run-count is a shortint variable.

Anyone has idea what to do?

Best Regards
Michal

Have another script that runs every couple of hours, or every day or so, that Removes the 2-second script’s entry from Scheduler, and replaces it with a fresh one.

Let me know if you need help with the coding.

-K

I don’t think that counter will affect operation of RouterOS, just an invalid counter number will be displayed.

Hello

Thanks for your reply. Well i know tha another script would be a solution however in ROuterOS 2.9 there’s no option or i can’t find it to reset the counter, /system script set 0 run-count=0 says there’s no argument like run-count. Does anybody know what to do??

Best Regards

Michal

Nope, you can’t change the Run Count.

You’ll have to replace the Scheduler entry entirely if you want to get rid of the high number.

I happen to come across this once when I was doing some scripting. I had accidentally deleted one of my scripts. I then just did the undo function and it restored it with a 0 run count.
Try something like this.

/system script remove NAMEOFSCRIPT
/undo

P.S. For giggles I thought I would see what happened if I put it in the original script instead of a separate one. It worked…

-Louis

I would like to see this feature in future versions of RouterOS.

Sometimes I want to run a script once, until run-count is reset to zero. There are also times when I want to run the script until x number of executions, or run another script after the first one has run for x number of executions.

This can probably solve this with environments, but it would be easier this way.