Replies: 2 comments
-
Do you really need the quirk? Croner supports ANDing dom and dow using option |
Beta Was this translation helpful? Give feedback.
-
I'm already using such option because that's the only way for the solution of the article to work. However, then the problem is
This seems to work, but is it standard syntax? I can't find anything about it, not even in the |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
For a project I'm working on, I need to run a task every first Monday of the month. To do so, I found a nice solution using the cron pattern
0 0 */100,1-7 * MON
. According to thecrontab
man page, if both the day of month and day of week fields are restricted, the command will be run when either field matches the current time. However, according to the documentation, any value that starts with an asterisk is unrestricted: this quirk is being exploited to build a pattern that uses both fields, and makes the day both restricted and unrestricted at the same time.Looking at the source code of
vixie/cron
, it's indeed possible to see that this works as mentioned in the article. However, this library is more strict about the maximum allowed step values, so the pattern throws the following error:Syntax error, max steps for part is (31)
. Would it be acceptable to remove such validation, or make it optional?Beta Was this translation helpful? Give feedback.
All reactions