简体   繁体   中英

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.

  1. job1.php Should run once in a day at 9:12 AM on Monday to Friday. (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. (five days in a week)

I have another 4 cron jobs which needs to be implemented in my project. 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.

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

*    *    *    *    *  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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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