Community discussions

MikroTik App
 
gacopl
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 63
Joined: Sun Jul 29, 2007 5:11 pm
Location: Poland

reset run-count in /system scripts

Fri Oct 26, 2007 12:40 pm

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
 
User avatar
krigevr
Member Candidate
Member Candidate
Posts: 155
Joined: Mon Aug 20, 2007 7:02 pm
Location: South Africa

Re: reset run-count in /system scripts

Fri Oct 26, 2007 7:04 pm

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
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 7187
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: reset run-count in /system scripts

Fri Oct 26, 2007 8:14 pm

I don't think that counter will affect operation of RouterOS, just an invalid counter number will be displayed.
 
gacopl
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 63
Joined: Sun Jul 29, 2007 5:11 pm
Location: Poland

Re: reset run-count in /system scripts

Tue Oct 30, 2007 1:36 pm

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
 
User avatar
krigevr
Member Candidate
Member Candidate
Posts: 155
Joined: Mon Aug 20, 2007 7:02 pm
Location: South Africa

Re: reset run-count in /system scripts

Tue Oct 30, 2007 2:05 pm

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.
 
User avatar
Letni
Member
Member
Posts: 376
Joined: Tue Dec 05, 2006 5:16 am
Location: South Carolina

Re: reset run-count in /system scripts

Tue Oct 30, 2007 2:10 pm

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
 
User avatar
THG
Member
Member
Posts: 472
Joined: Thu Oct 15, 2009 1:05 am

Re: reset run-count in /system scripts

Mon Dec 02, 2013 12:22 am

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.

Who is online

Users browsing this forum: No registered users and 6 guests