Cron调度配置咨询:每日8:00-22:30每分钟执行的可行性
You can absolutely configure Cron to run your task every minute between 8:00 AM and 22:30 PM daily. The key is breaking the time window into two manageable chunks, since Cron doesn’t natively support partial-hour ranges in a single rule without splitting things up.
Here’s how to set it up properly:
Option 1: Two Clear, Readable Cron Entries
This is my recommended approach—easy to understand and maintain for anyone who touches the config later:
For full hours (8:00 AM to 9:59 PM):
* 8-21 * * * /path/to/your/task-or-scriptThe
*in the minute field means "every minute", and8-21covers all hours from 8 AM through 9 PM (21:00 in 24-hour time).For the partial hour (10:00 PM to 10:30 PM):
0-30 22 * * * /path/to/your/task-or-scriptHere,
0-30restricts execution to minutes 0 through 30, and22targets only the 10 PM hour.
Quick Side Note
Standard Cron doesn’t let you combine these into a single valid line because the minute and hour conditions are dependent. Trying to cram it into one line would either be invalid or miss some minutes—stick with the two-entry approach for clarity.
Also, don’t forget to replace /path/to/your/task-or-script with the actual command or script path you want to run. Most standard Unix/Linux systems use the 5-field Cron format (minute, hour, day, month, weekday), but double-check your system’s syntax if you’re using a specialized Cron tool.
内容的提问来源于stack exchange,提问作者Alexey Smirnov

