Schedule jobs to run on specific weekdays #5

dbader opened this Issue May 29, 2013 · 2 comments


None yet
2 participants

dbader commented May 29, 2013

e.g. every() and every()"10:30").do(job)

(This was suggested on reddit by kweer)

We could also go crazy with allowing longer intervals, for example every() but I think this would be out of schedule's scope. Reliably handling infrequent jobs with large intervals requires persistent state. This is better left to tools specialized for this job, such as cron.

Reddit user fdemmer suggested directly using datetime and timedelta objects for maximum flexibility.

imiric commented Aug 26, 2013

Hey, just saw this issue.

I have this implemented in the feat/onbetween branch, as the .on() method.

The syntax is:

on('Tuesday', 'thu').at('10:30').do(job)

You can also do more complex stuff like:

on('sun|mon', 'wed|thu').between("07:00 PDT-19:00 PDT").do(job)

The pipe is used as an OR operator, so this job will run on Sunday or Monday and on Wednesday or Thursday.

The .between() is another feature in the same branch.

Longer intervals can be done like so:


You're right about persistent state. In this case, if the scheduler process is interrupted, the time/date chosen next time it's run might be different. But for my use case this is not an issue. And it certainly beats using cron/at which is what we used before and it was a convoluted mess.

imiric referenced this issue Aug 26, 2013


Job store support #17


dbader commented Mar 16, 2014

Done in #22

dbader closed this Mar 16, 2014

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