排除特定日期的时间块 [Quartz Schedule]
我正在使用 Quart 调度程序。我想以这种方式触发,以便排除指定日期(星期一、星期五、星期日)从 xx:xx:xx 到 yy:yy:yy 的时间。我知道如何排除特定的一天。但不知道如何不在给定日期的给定时间块触发?
有人可以知道吗?
I am using Quart Scheduler. I want to trigger to in such a fashion so as it excludes timing from xx:xx:xx to yy:yy:yy on day specified (monday, friday. sunday). I know how to exclude particular day. but don't know how not to trigger on given time block on given day?
Can anybody know anything about it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
请使用 Quartz 中提供的 Calendar 和 HolidayCalendar 来实现此目的。 Cron-Trigger 中的 Cron 表达式也可以巧妙地编写来实现这一点。
Please make use of Calendar and HolidayCalendar available in Quartz to achieve this. The Cron expression in Cron-Trigger can also be written smartly to achieve this as well.
查看 http://www.quartz-scheduler.org/docs/examples/Example3 .html,似乎可以创建不同的作业集来完成相同的任务。对于每项工作,可以附上一份时间表。
如果您不想在周日下午 1 点到晚上 10 点之间运行特定任务,但希望它在周日剩余时间运行,那么您可以创建两个作业 [设置为执行相同的任务]。请给出时间限制为 00:00 至 13:00 的时间表。第二次的时间限制为 22:00 至 23:59。
我希望我正确理解你的问题......
Looking at http://www.quartz-scheduler.org/docs/examples/Example3.html, it seems that one can create different job set to do the same task. For each job one can attach a schedule.
If you dont want to run a particular task on say sunday between 1pm and 10pm, but want it to run on sunday the remainder of the day, then you can create two jobs [set to do the same task]. For one give the schedule with time restrictions 00:00 to 13:00. And for the second give time restriction of 22:00 to 23:59.
I hope I understood your problem correctly ...