Please add MONTH parameter in scheduller

Please could you add month parameter in scheduller?

You can do it with a script like this:


:if ($actual_month = $your_month) do={anything}


You can get actual month from clock menu.




sent from my mobile phone using tapatalk

Maybe he wants to run something monthly. I would run it daily and check actual day. If it is the first day of month then do…

yes monthly…

You can use interval to do that. Set interval to 30 days or 4 weeks or how you prefer it.

Normis, it is not smart… Calendar calculations are no so easy. Monthly is not the same like each 30 days or each fourth week.

But then it will not be called an interval :slight_smile:

Sure it would. Depending on what are the units you are measuring it. One month is as good as one day or one week to measure the interval. The fact that you cannot easily say how many weeks correspond to one month doesn’t mean you cannot measure time in months if it is more suitable for you.

I understand the request, but to call something interval, it must be the same lenght always.

One month interval is always one month long. :smiling_face:

Yeah, except that one month isn’t a constant interval of time. When we say “one month” we mean “this date, next month, or the last possible date of the next month if the next month is bigger”. So if it’s 4 March, we want to go to 4 April, and if it’s 4 April, go to 4 May… But the “distance” between March and April is 31 days, whereas the distance between April and May is 30 days. And if it’s 30 January, you want to go to 28 February, which means one more special case in your logic.


If the dates you want to do “+ 1 month” are all under 28 (i.e. there’s always a corresponding date next month), you could use a script to split the current router date into day, month and a year, change the month, and just supply the result into scheduler’s “start-date”. That alone is simple enough.

If you want to also handle edge cases like dates between 28 and 31… If I needed that, I’d probably create the scheduler script via the API. In other environments, such as PHP, there are date and calendar functions. In the case of PHP, it’s as simple as using DateTime::add(). You do that over the current date and time, find out the difference in days, and add that as an interval. If the script needs to perpetuate itself, schedule it to finish off with a “/tool fetch” to the web server, which would modify it for the next month.

this is also good idea, or to use linux cron to log in…
but it should be in routerOS…
the other option is to make 12 scripts, to run periodicaly:)

One question:
For example, supposing the parameter exist,
what must happen if for some reason script can not be run, for example, power failure, etc.
What you expect to happen?

And at what time you expect to run the script? at midnigth of first day of the mont?

propably you dont know NTP function:)
I would like to be to be same interval as in linux cron: every week, every sunday, saturday…

As rextended asked: When would you excpect it tu run? On the first of each month at 5:32 AM or on the 15-th at 3:17 PM? You see, monthly is very relative. An “one month from now” also implies some uncertainty.
I support the solution of a script that runs daily, checks the date and runs the desired action on a certain date.

propably you dont know NTP function > :slight_smile:

(yes I notice the " :slight_smile: ")
What reply is this?

My questions are:

Supposing the parameter exist (montly),
what must happen if for some reason script can not be run, for example, power failure, etc.
What you expect to happen?
And at what time you expect to run the script? at midnigth of first day of the mont?

If someone ask that questions, problably is why someone can write one script for you…