I’m trying to trigger a rule to fire every 2 minutes from 6:45am to 8am. I can get it to work from 7am to 8am with:-
when Time cron “0 */2 7-8 ? * MON-FRI” then
Time cron “0 45/2 6-8 ? * MON-FRI”
Fires from 6:45 to 7am and then from 7:45 to 8am (firing every 2 minutes in both cases)
I can understand why the cron does this, but can’t work out the correct syntax for what I want.
Can anyone help?
I’m no cron expert but I don’t think you can do that. The problem is in cron each field is handled independently so there really is no way to specify the time like you want to using just one cron statement. But there is nothing that says you have to use only one statement to trigger your rule.
Time cron "0 45/2 6 ? * MON-FRI" or
Time cron "0 */2 7 ? * MON-FRI"
The first should trigger the rule between 6:45 and 7:00 and the second one between 7:00 and 8:00. You will probably have a hick-up in the transition between the first trigger and the second one where the rule triggers after one minute, but I’m not certain.