I'm trying to configure a Hangfire job that starts at 3:33am in the morning and runs every 5 minutes until 4pm in the afternoon, Monday-Friday.
Unfortunately if I do 33/5 3-15 * * 1-5
, this only runs between 33 minutes past the hour until the hour, then it sleeps from 0-33 minutes every hour until the 33rd minute.
I've tried 33-32/5 3-15 * * 1-5
, but this produces the same result as above.
One solution is to make two jobs (#1 33-59/5 3 * * 1-5
and #2 */5 4-15 * * 1-5
), but I figure there must be some way to do this out of the box. Help!
I am afraid your solution with 2 schedules is exactly what you need.
You cannot do that by one schedule, as this is not how cron works: at start it determines the first time to run job, then at the time when job needs to be executed, cron calculates next time in the future, when the job should be run.
If you interesting in more details, look at SO How does cron internally schedule jobs.