简体   繁体   English

Cron工作从星期一到星期五的9:15 AM到3:30 PM每分钟运行

[英]cron job to run each minutes from monday to friday from 9:15AM to 3:30PM

I have to run two cron jobs for the following scenarios. 在以下情况下,我必须运行两个cron作业。

  1. job1.php Should run once in a day at 9:12 AM on Monday to Friday. job1.php应该在星期一至星期五的上午9:12每天运行一次。 (five days in a week) (一周中的五天)
  2. job2.php Should run in each minutes from 9:15 AM to 3:30 PM on Monday to Friday. job2.php应该在星期一至星期五的9:15 AM到3:30 PM之间的每分钟运行。 (five days in a week) (一周中的五天)

I have another 4 cron jobs which needs to be implemented in my project. 我还有另外4个Cron工作,需要在我的项目中实施。 But all that can be derived from the above two scenarios. 但是所有这些都可以从上述两种情况得出。

First one is easy. 第一个很简单。

12 9 * * 1-5 <full_path>/job1.php

Second one is tricky. 第二个是棘手的。 I split that into 3 entries. 我将其分为3个条目。

15-59 9 * * 1-5 <full_path>/job2.php

* 10-14 * * 1-5 <full_path>/job2.php

0-30 15 * * 1-5 <full_path>/job2.php

Cron Syntax Cron语法

*    *    *    *    *  command to be executed
┬    ┬    ┬    ┬    ┬
│    │    │    │    │
│    │    │    │    │
│    │    │    │    └───── day of week (0 - 6) (0 is Sunday, or use names)
│    │    │    └────────── month (1 - 12)
│    │    └─────────────── day of month (1 - 31)
│    └──────────────────── hour (0 - 23)
└───────────────────────── min (0 - 59)

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

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