在特定时间运行任务

huangapple go评论40阅读模式
英文:

Running a job during specific times of the day

问题

I am writing a code to run a job during specific time frames of weekdays. I.e., I need this job to run every 5 mins between 9 AM to 5 PM on weekdays. I could achieve this behavior by programmatically scheduling and disabling the job. Is there any out of the box option available to achieve similar behavior?

英文:

I am writing a code to run a job during specific time frames of weekdays. I.e i need this job to run every 5 mins between 9 AM to 5 PM on weekdays. I could achieve this behavior by programmatically scheduling and disabling the job. Is there any out of the box option available to achieve similar behavior?

答案1

得分: 0

我可以使用以下的 cron 表达式来实现这个。Cron 表达式很强大!

0 0/2 9-16 ? * SUN,MON,TUE,WED,THU *
英文:

I could achieve this with help of below cron expression. Cron expressions rock !!

0 0/2 9-16 ? * SUN,MON,TUE,WED,THU *

huangapple
  • 本文由 发表于 2020年7月28日 10:55:08
  • 转载请务必保留本文链接:https://go.coder-hub.com/63126354.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定