A
A
Andrey Ivanov2015-02-16 13:09:56
Task Schedulers
Andrey Ivanov, 2015-02-16 13:09:56

How should the rule for cron 0,20,40 * 29 2 7 work?

In general, initially this rule was 0.20.40 * * * *
That is, every hour at 0, 20 and 40 minutes.
But after that, I needed to temporarily disable the task (and I didn’t feel like deleting it) and I wanted to set the conditions 0.20.40 * 29 2 7 that were impossible in the near future.
I thought that in this case the task would be executed in the same way every hour at 0, 20, 40 minutes, but only on February 29 and if it is Sunday, which is unlikely.
But last Sunday, February 15, the script started working. What is it? This is obtained if there is no 29th day in the month, then the * sign is substituted instead of the day, as it were? And it turns out execution every Sunday in February?
But using the service (I don't know if it works correctly) cron.schlitt.info/index.php?cron=0%2C20%2C40+*+29+... I'm completely confused.
It shows that the script will be executed on Sundays in February 2016, also without looking at the day of the month, although in 2016 there is such a day - February 29th.
Please bring clarity to my clouded head.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
DevMan, 2015-02-16
@orange12

But after that I needed to temporarily disable the task
This is solved by commenting out the line, not by changing the time.
All conditions (start time) are checked by "logical AND", except for the conditions "day of the week" and "day of month" - specified together, they are processed by "logical OR", that is, "on any of the days", which is reflected in man- page (Ubuntu, Debian, FreeBSD). However, this logic is not obvious and does not allow you to create a condition like "first Monday of every month" or "every Friday on the 13th". Developers do not change this behavior, considering it as a standard

A
Andrey Ivanov, 2015-02-17
@orange12

Thanks for the answer.
As for commenting, yes, that's what I do mostly.
But when shared hosting and everything is managed through the hosting panel, then there is often no such feature as disabling the task. And each time I don’t really want to delete and then, if necessary, restore the record. That's how he did it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question