Community discussions

MikroTik App
 
User avatar
arjuneu
Member Candidate
Member Candidate
Topic Author
Posts: 173
Joined: Fri Oct 07, 2011 10:24 am

Scheduler Question

Thu Oct 10, 2013 7:05 am

Hello,
Is there an option to run a scrip only 6 days a week?

I need this soon.
 
User avatar
cbrown
Trainer
Trainer
Posts: 1839
Joined: Thu Oct 14, 2010 8:57 pm
Contact:

Re: Scheduler Question

Thu Oct 10, 2013 3:09 pm

You could set 6 different schedules to run every 7 days.
 
User avatar
skot
Long time Member
Long time Member
Posts: 584
Joined: Wed Nov 30, 2011 3:05 am

Re: Scheduler Question

Thu Oct 10, 2013 6:56 pm

You could also use this script: http://wiki.mikrotik.com/wiki/Script_to ... f_the_week

Schedule it to run every day, and it will skip the day you choose.

ros code

:local date [/system clock get date]

:local result ""
:local months [:toarray "jan,feb,mar,apr,may,jun,jul,aug,sep,oct,nov,dec"]
:local monthtbl [:toarray "0,3,3,6,1,4,6,2,5,0,3,5"]
:local daytbl [:toarray "sun,mon,tue,wed,thu,fri,sat"]

:local month [:pick $date 0 3]
:local day [:pick $date 4 6]
:local dayc [:pick $date 5 6]
:local century [:pick $date 7 9]
:local year [:pick $date 9 11]
:local yearc [:pick $date 10 11]

:if ([:pick $date 4 5] = 0) do={:set day ($dayc)}
:if ([:pick $date 9 10] = 0) do={:set year ($yearc)}

:local sum 0
:set sum ($sum + (2 * (3 - ($century - (($century / 4) * 4)))))
:set sum ($sum + ($year / 4))
:set sum ($sum + $year + $day)
:for mindex from=0 to=[:len $months] do={
  :if ([:pick $months $mindex] = $month) do={:set sum ($sum + [:pick $monthtbl $mindex]) }
}
:set sum ($sum - (($sum / 7) * 7))
:set result [:pick $daytbl $sum]

# If today is not Monday, run your script
:if ($result != "mon") do={
  ...
}

Who is online

Users browsing this forum: Amazon [Bot], Bing [Bot], Google [Bot] and 120 guests