问题描述
我正在尝试在每月第二个星期一运行一次的hangfire中创建定期作业,如下所示:1. 2018年5月14日星期一8:00 AM2. 2018年6月11日星期一8:0 AM3. 2018年7月9日星期一8:00 AM4. 2018年8月13日星期一8:00 AM5. 2018年9月10日星期一8:00 AM
I am trying to create recurring job in hangfire that runs, once a month at the second Monday, something like this:1. Monday, May 14, 2018 8:00 AM2. Monday, June 11, 2018 8:0 AM3. Monday, July 9, 2018 8:00 AM4. Monday, August 13, 2018 8:00 AM5. Monday, September 10, 2018 8:00 AM
我发现这个问题在stackoverflow中,但是由于这不是调度hangifre作业的标准cron,因此我无法使用它.
I have found this answer in stackoverflow, but since this is not a standard cron for scheduling hangifre jobs I can not use it.
我的问题是我可以使用以下格式进行这样的表达吗?* * * * *(分钟小时/日/月/日/周)
My question is can I make an expression like this using the format * * * * * (min hour day/month month day/week)
推荐答案
minute hour day month dayofweek command
0 0 8-14 * 2 /path/here
这将在每月的第二个星期二午夜运行一次工作.
This will run a job every second tuesday of the month at midnight.
8-14将星期二的发生限制在该月的第二周.
8-14 limits the occurance of tuesday to the second week in the month.
1-7 first week
8-14 second week
15-21 third week
22-28 forth week
29-31 fifth week
这篇关于每月第二个星期一的Cron表达(适用于Hangfire)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!