简体   繁体   English

用于安排作业的 Cron 表达式

[英]Cron Expression to schedule a job

I would like to run my code on specific schedule.So i need a cron expression to schedule a job for every 12th day of the month by excluding saturdays and sundays (means scheduling a job only on weekdays for every 12th day of the month).我想按特定的时间表运行我的代码。所以我需要一个 cron 表达式来通过排除星期六和星期日来安排每个月的第 12 天的作业(意味着仅在每个月的第 12 天的工作日安排作业)。 Is this possible to schedule??这个可以安排吗??

Can someone help for the solution to get me out here有人可以帮我解决这个问题吗

Yes it's easily possible .,这很容易。

5 4 */12 * 1-5

“At 04:05 on every 12th day-of-month if it's on every day-of-week from Monday through Friday.” “如果是从周一到周五的每一天,则在每月的第 12 天的 04:05。”

Edit : I misunderstood the question, sorry.编辑:我误解了这个问题,对不起。 I don't think that's possible only with the CRON string itself.我不认为只有 CRON 字符串本身才有可能。

As an easy solution proposal: just schedule the task itself every business day (eg 5 4 * * 1-5 ) and then check at the start of the job if it is the 12th business day of the month .作为一个简单的解决方案建议:只需在每个工作日安排任务本身(例如5 4 * * 1-5 ),然后在工作开始时检查它是否是每月的第 12 个工作日 If so, start your business process and if not just exit.如果是这样,请开始您的业务流程,如果不只是退出。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM