- Notifications
You must be signed in to change notification settings - Fork88
Description
Cronie follows the standard Vixie-cron behavior where a specified day-of-month and day-of-week are treated as alogicalOR. This means a job runs if either condition is met.
It would be very useful to have a pattern-specific way to switch this to alogicalAND. This would allow for schedules like "run on the 1st of the month only if it is also a Monday."
I've started an effort to make a detailed specification for existing and new features of cron, TheOCPS-project.
In increment 1.4 (draft), I've added a section on this, looking something like:
4.1.2. Explicit AND Logic (+ Modifier)
To provide a portable, unambiguous method for requiring both date conditions to be met, OCPS 1.4 introduces the+ (plus) modifier.
- Functionality: When the
+character precedes the value in theDay of Weekfield, the logical combination for that specific pattern MUST be treated as a logicalAND. - Syntax:
- The
+modifier is ONLY valid as the first character of theDay of Weekfield. - Its use in any other field or position MUST be treated as a parsing error.
- The
- Example (
0 12 1 * +MON):- Default (OR)
0 12 1 * MON: Triggers at noon on the 1st of the monthOR at noon on every Monday. - With
+Modifier0 12 1 * +MON: Triggers at noonONLY IF the 1st of the month is also a Monday.
- Default (OR)
+ is suggested over other alternatives like& and! for safety and clarity:& is a shell command modifier, and! commonly means NOT.
What do you think about this, could it be implemented in cronie?