How do you run a cron job every minute only on specific hours? Like so:
It will only check every minute from 11AM to 12AM, 4PM to 5PM and 9PM to 10PM<
Right solution:
* 11,16,21 * * *
Because if you use previous solution:
0-59 11-12,16-17,21-22 * * * *
Job will start at 12:40 or 17:59. It is not in range from 11AM to 12AM, 4PM to 5PM and 9PM to 10PM.
UPDATE:
Traditional (inherited from Unix) cron format consists of five fields separated by white spaces:
* * * * * 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)
nnCron can use both traditional and "enhanced" version of cron format, which has an additional (6th) field: Year.