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

New feature: Option for legacy dom-OR-dow #53

Closed
Hexagon opened this issue Feb 15, 2022 · 7 comments
Closed

New feature: Option for legacy dom-OR-dow #53

Hexagon opened this issue Feb 15, 2022 · 7 comments
Milestone

Comments

@Hexagon
Copy link
Owner

Hexagon commented Feb 15, 2022

By default, croner work differently from the standard refered to by @vixie. If you specify both day-of-month and day-of-week ( 0 0 1 * MON) croner would only run when there is a monday at the 1st of any month. This enable you to set patterns that run on the first monday of any month (0 0 1-7 * MON) and other clever stuff.

In classic cron (Vixie, for example), day-of-month and day-of-week are ORed, which makes 0 0 1 * MON run at the 1st of any month AND at mondays.

	/* the dom/dow situation is odd.  '* * 1,15 * Sun' will run on the
	 * first and fifteenth AND every Sunday;  '* * * * Sun' will run *only*
	 * on Sundays;  '* * 1,15 * *' will run *only* the 1st and 15th.  this
	 * is why we keep 'e->dow_star' and 'e->dom_star'.  yes, it's bizarre.
	 * like many bizarre things, it's the standard.
	 */

Croner should support this with options, maybe

{ 
   legacyMode: true
}
@Hexagon Hexagon added this to the 4.1.96 milestone Feb 15, 2022
@Hexagon Hexagon changed the title New feature: dom OR New feature: Option for legacy dom-OR-dow Feb 15, 2022
@vixie
Copy link

vixie commented Feb 15, 2022 via email

@Hexagon Hexagon modified the milestones: 4.1.96, 4.1.97 Feb 15, 2022
@Hexagon
Copy link
Owner Author

Hexagon commented Feb 17, 2022

Implemented in 4.2.0

@Hexagon
Copy link
Owner Author

Hexagon commented Sep 18, 2022

Legacy mode (dom-OR-dow) is default from 5.0.0

You can switch to "croner mode" (dom-AND-dow) by passing option { legacyMode: false }

@vixie
Copy link

vixie commented Sep 18, 2022

nice. thanks.

@b-a0
Copy link

b-a0 commented May 23, 2023

Hi,

In Uptime Kuma this option might introduce a feature I would find helpful. However, there are concerns that this option is not there to stay due to the name containing the word "legacy" and if/when it's deprecated this would cause issues.

Is the legacyMode option a temporary parameter until everyone has moved on to the default dom-OR-dow behaviour, or is it there to stay and does it simply provide an additional permanent feature?

@Hexagon
Copy link
Owner Author

Hexagon commented May 23, 2023

@b-a0

The option legacyMode: true/false is a permanent feature, and will never be be deprecated.

The word legacy is used to indicate that the pattern is treated the same way as legacy tools, and is the default mode since 5.0... Setting legacyMode to false enables extra features, and will probably always be a opt-in.

@vixie
Copy link

vixie commented May 23, 2023

seems legit to me.

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

No branches or pull requests

3 participants