secThe seconds field in Quartz and Spring cron
Quartz and Spring put seconds first, giving six fields. Unix cron, Kubernetes, Jenkins, GitHub Actions and EventBridge have no seconds, so one minute is their finest unit.
The rules
- The first field is seconds, 0-59.
- Use 0 to fire at the start of the minute.
- Leaving it as * fires 60 times a minute during the matching minutes.
- To convert from five-field cron, add 0 in front.
Examples you can copy
0/30 * * * * ?Every 30 seconds. Every 30 seconds.
First runs after 1 Jan 2027 (UTC): Fri, 01 Jan 2027, 00:00 · Fri, 01 Jan 2027, 00:01 · Fri, 01 Jan 2027, 00:01
0 */5 * * * ?Every 5 minutes. Every 5 minutes, at second 0.
First runs after 1 Jan 2027 (UTC): Fri, 01 Jan 2027, 00:05 · Fri, 01 Jan 2027, 00:10 · Fri, 01 Jan 2027, 00:15
* */5 * * * ?Every second, every 5 minutes. Wrong on purpose: fires every second of every fifth minute (60 times).
First runs after 1 Jan 2027 (UTC): Fri, 01 Jan 2027, 00:00 · Fri, 01 Jan 2027, 00:00 · Fri, 01 Jan 2027, 00:00
*/10 * * * * *Every 10 seconds. Every 10 seconds in Spring.
First runs after 1 Jan 2027 (UTC): Fri, 01 Jan 2027, 00:00 · Fri, 01 Jan 2027, 00:00 · Fri, 01 Jan 2027, 00:00
Common mistakes
- Pasting a five-field crontab line into Spring or Quartz. It will be rejected, or its fields will shift.
- Leaving * in the seconds position by habit, which makes the job fire every second.
Frequently asked questions
How do I run something every 5 seconds in Kubernetes?
You cannot with a CronJob. Run a long-lived process with its own loop, or a sidecar.