Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Settings the day of week and day of month. #131

Open
treadon opened this issue Nov 4, 2016 · 2 comments
Open

Settings the day of week and day of month. #131

treadon opened this issue Nov 4, 2016 · 2 comments

Comments

@treadon
Copy link

treadon commented Nov 4, 2016

If both fields are restricted (for day of month and day of week) a cron should match for either case, as per the cron man:

 Note: The day of a command's execution can be specified by two fields --
 day of month, and day of week.  If both fields are restricted (ie, are
 not *), the command will be run when either field matches the current
 time.  For example, ``30 4 1,15 * 5'' would cause a command to be run at
 4:30 am on the 1st and 15th of each month, plus every Friday.

However, in a test with the following expression:

0 16 4 * fri *

The expected behavior is every Friday OR every month on the 4th.

However, when running this, it matches if it is a Friday AND it is the forth: here is sample output:

Next: Fri, 04 Nov 2016 16:00:00 +0000
Last: Fri, 04 Mar 2016 16:00:00 +0000

Great library otherwise.

@svamja
Copy link

svamja commented Sep 20, 2018

Please dont change the week + day-of-month into "OR" combination.
"AND" is very useful in below practical scenario:

"First sunday of month"
0 0 1-7 * 7

This is not possible in the "OR" condition.

@cedric-r-mycelium
Copy link

you must use two cron expression for this

0 16 4 * * *
0 16 1-7 * fri *

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants