每小时第1分钟执行Cron任务的配置问题求助
Correct Cron Configuration for 1 Minute Past Every Hour
Let's break this down for you — you're trying to run a cron job at 1 minute past every hour (0:01, 1:01, ..., 23:01), and your current attempts aren't hitting the mark. Here's what you need to do, depending on which cron syntax you're using:
1. Standard Linux/Unix Cron (5-field syntax)
Standard cron uses the format: minute hour day month weekday
Your correct configuration here is:
1 * * * *
1: Triggers at the 1st minute of the hour*: Matches any hour, day, month, or weekday
This will run exactly at 0:01, 1:01, ..., 23:01 every day.
2. Quartz Cron Expression (7-field syntax, common in Java apps, Jenkins, etc.)
Quartz uses the format: second minute hour day month weekday year (year is optional)
Your correct configuration here is:
0 1 * * * ?
Or with the optional year field included:
0 1 * * * ? *
0: Runs at the 0th second of the target minute1: Targets the 1st minute of every hour*: Matches any hour, day, or month?: Avoids conflicts between the "day" and "weekday" fields (we don't want to restrict either here)
Why your previous attempts didn't work
- Your first config
0 * * * * ? *: Sets the second to 0, but the minute to*(any minute) — so it runs every minute at 0 seconds, not just the 1st minute of each hour. - Your second config
0 */1 * * * ? *: Sets the hour to run every 1 hour, but again uses*for minutes — so it runs every minute of every hour at 0 seconds, which isn't what you need.
内容的提问来源于stack exchange,提问作者Sa'ad Qasaymeh
相关产品推荐
相关产品推荐

