Running APScheduler Job Every nth Day of Month

2019-08-09 15:34发布

I'm looking for an APScheduler trigger that will execute a job every nth day of a month. For example, I want to run a job on the first Tuesday of every month. Or on the first and third Monday of every month.

Does anyone have a trigger that accomplishes this? You can almost do it with the cron scheduler and having your function double-check that it's running at the right time: Cron job to run every first or last chosen day of week of every month

1条回答
你好瞎i
2楼-- · 2019-08-09 16:06

Using the documentation of the cron trigger:

scheduler.add_job(func, 'cron', day='1st tue')
scheduler.add_job(func, 'cron', day='1st mon,3rd mon')
scheduler.add_job(func, 'cron', day='1st fri,last fri')
查看更多
登录 后发表回答