Cron表达-在上午7点至晚上8点之间每5秒钟...? [英] Cron Expression - Every 5 seconds between 7am and 8pm...?
本文介绍了Cron表达-在上午7点至晚上8点之间每5秒钟...?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在Quartz.net中使用以下Cron表达式:
I have the following Cron expression i use with Quartz.net:
0/5 * *吗?* MON-FRI
0/5 * * ? * MON-FRI
基本上,每隔5秒,星期一至星期五.
Basically, every 5 seconds, Mondays - Fridays.
我该如何修改它,使其仅在那一天的上午7点至晚上8点之间运行?
How can I modify this so it only runs between 7am and 8pm on those days?
推荐答案
该条目将在周一至周五的7:00至7:55之间每五分钟显示一次 :
This entry would be for every five minutes between 7:00 and 7:55 on Mon to Fri:
0/5 7 * * 1-5 who /usr/bin/what
以运行/usr/bin/what
的用户谁
的身份.据我所知,可以配置 cron
的最小单元是一分钟.
as user who
running /usr/bin/what
. To my knowledge, the smallest unit that cron
can be configured with is a minute.
但是您可以在周一至周五的上午7:00开始,然后自己开始
But you could start something at 7:00am on Mon to Fri which then itself would
do {
work
sleep(5) // or sleep(4) or whichever, depending on length of work task
} while (not yet 08:00am)
组装起来并不难.
这篇关于Cron表达-在上午7点至晚上8点之间每5秒钟...?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文