Problem:
We’re trying to create some Recurring Logic that require complex Cronlines.
For example, we want to install updates on a subset of the machines on the second Tuesday of every month.
The Cronline for this situation looks like this:
0 8 7-14 * */2
- https://crontab.guru/#0_8_8-14__/2
irb(main):002:0> ForemanTasks::RecurringLogic.find(30)
=> #<ForemanTasks::RecurringLogic id: 30, cron_line: “0 8 7-14 * */2”, end_time: nil, max_iteration: nil, iteration: 1, task_group_id: 146, state: “active”, triggering_id: 80, purpose: nil>
At 08AM, on the days between the 7th and 14th (all possible days where the second Tuesday of the month can fall), on every month, on every second day of the week
We also tested
0 8 7-14 * 2
- https://crontab.guru/#0_8_8-14_*_2
irb(main):004:0> ForemanTasks::RecurringLogic.find(35)
=> #<ForemanTasks::RecurringLogic id: 35, cron_line: “0 8 8-14 * 2”, end_time: nil, max_iteration: nil, iteration: 1, task_group_id: 159, state: “active”, triggering_id: 86, purpose: nil>
Which is similar as the one above but instead of on every second day of the week it’s on Tuesday, but not even the crontab.guru shows the expected date of the next occurrence.
Another example: trying to run something every 4th Wednesday (today)
30 12 22-31 * */4
- https://crontab.guru/#30_12_22-31__/4
It correctly scheduled and run the job today, but the next occurrence is tomorrow which is Thursday.
irb(main):003:0> ForemanTasks::RecurringLogic.find(33)
=> #<ForemanTasks::RecurringLogic id: 33, cron_line: “30 12 22-31 * */4”, end_time: nil, max_iteration: nil, iteration: 2, task_group_id: 153, state: “active”, triggering_id: 83, purpose: nil>
Expected outcome:
We expected the schedules to be correct.
Foreman and Proxy versions:
- foreman: 3.5.1
Foreman and Proxy plugin versions:
- foreman-tasks: 7.1.1
- foreman_remote_execution: 8.2.0
- katello: 4.7.2
Distribution and version:
Oracle Linux 8.7
Other relevant data: