Community discussions

MikroTik App
 
enuro12
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 61
Joined: Fri Apr 29, 2011 4:09 am

Script Running Problem

Wed May 04, 2011 6:16 am

I'm hoping this is a very simple question.

I've copied this script into my 'scripts'. I click run and the counter increases by 1, however the SXT doesn't do anything. It seems i should be putting it in a loop, but i cant figure out how. =\

I've been poking around in the manual which is where i found the script, but cant find any how to on it.
 
bburley
Frequent Visitor
Frequent Visitor
Posts: 80
Joined: Thu Nov 18, 2010 7:22 am
Location: Alberta, Canada

Re: Script Running Problem

Wed May 04, 2011 8:28 am

It can be very easy to make a typo or have some unexpected error from transferring a script to a different model or hardware type. There aren't many easy ways to troubleshoot a script. One method I use for feedback is to insert a logging command at various points in the script, such as;

:log info "message text"

or

:log info strvariablename

If it doesn't write to the log, comment out script lines until it does. Eventually you will locate the problem.
 
enuro12
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 61
Joined: Fri Apr 29, 2011 4:09 am

Re: Script Running Problem

Wed May 04, 2011 7:16 pm

Thanks for the reply.

Do scripts loop automatically or do i need to add something extra for that?
 
krakenant
Member Candidate
Member Candidate
Posts: 135
Joined: Sat Feb 06, 2010 6:32 am

Re: Script Running Problem

Wed May 04, 2011 9:29 pm

You have to do a for or while command for it to loop. One thing I did to loop it was to add a counter logic, and while the counter was less than a number, continue running the while loop with a 1s delay at the end until the counter was higher than the timer. I basically set it so that when the counter hit 1200 seconds it would stop running and terminate the script. I then set a scheduler to run that script every 20 minutes in the event the script were to get stopped by another user or it got an error.
 
enuro12
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 61
Joined: Fri Apr 29, 2011 4:09 am

Re: Script Running Problem

Wed May 04, 2011 10:48 pm

Ahh, got it. Thanks !
 
enuro12
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 61
Joined: Fri Apr 29, 2011 4:09 am

Re: Script Running Problem

Wed May 04, 2011 10:48 pm

karma for taking the time!

Who is online

Users browsing this forum: No registered users and 26 guests