Every 5 Seconds
*/5 * * * * * 0/5 * * * * ? Runs every 5 seconds. Requires a seconds-aware dialect — Spring or Quartz — because standard Unix cron is minute-precision only.
Use in your stack
{
"schedule": {
"cron": "0/5 * * * * ?",
"timezone": "UTC"
}
}
// 6-field: second minute hour day-of-month month day-of-week
@Scheduled(cron = "*/5 * * * * *")
public void everyFiveSeconds() {
// ...
}
// Simpler for pure intervals — no cron parser needed:
@Scheduled(fixedRate = 5000) // milliseconds
public void everyFiveSecondsFixedRate() {
// ...
}
Next runs
Pick a timezone to see when this expression fires next.
- 012026-07-03T16:50:35.000Z
- 022026-07-03T16:50:40.000Z
- 032026-07-03T16:50:45.000Z
- 042026-07-03T16:50:50.000Z
- 052026-07-03T16:50:55.000Z
- 062026-07-03T16:51:00.000Z
- 072026-07-03T16:51:05.000Z
- 082026-07-03T16:51:10.000Z
- 092026-07-03T16:51:15.000Z
- 102026-07-03T16:51:20.000Z
Variations
Common use cases
- Polling a fast-changing queue or message broker for new work.
- Updating a live dashboard or real-time metric during development.
- Health-checking a low-latency service that needs sub-minute detection.
- Draining a buffer to a downstream system on a tight cadence.
Gotchas
- **Unix crontab cannot do this.** The 5-field format has no seconds field; its minimum interval is `* * * * *` (every minute). Kubernetes CronJob and GitHub Actions inherit the same limit.
- In Spring, `*/5 * * * * *` is the 6-field form (seconds first). Don't confuse it with Unix's 5-field `*/5 * * * *`, which means every 5 *minutes*.
- In Quartz, use `0/5 * * * * ?` — the `0/5` seconds field means "starting at second 0, every 5 seconds," and `?` fills the unused day-of-week field.
- For anything this frequent, a `fixedRate`/`fixedDelay` loop is often simpler and cheaper than a cron parser. Use `@Scheduled(fixedRate = 5000)` in Spring or `tokio::time::interval` in Rust.
- Overlap is a real risk at 5-second cadence — if the job ever takes longer than 5 seconds, runs stack up. Prefer `fixedDelay` (waits for the previous run) or an in-flight guard.
Standard cron — the kind in /etc/crontab, Kubernetes CronJobs, and GitHub Actions — has five fields starting at minutes. There is no seconds field, so “every 5 seconds” simply isn’t expressible. The finest you can schedule is once a minute.
To go sub-minute you need a 6-field, seconds-first dialect:
- Spring
@Scheduled(cron = "*/5 * * * * *")— see the Spring cron reference and the Spring @Scheduled guide. - Quartz
0/5 * * * * ?— see the Quartz cron reference.
But for an interval this tight, a plain timer is usually the better tool. Spring’s @Scheduled(fixedRate = 5000) and Rust’s tokio::time::interval(Duration::from_secs(5)) both express “every 5 seconds” without a cron parser — and they’re easier to reason about when a run might overrun its window.
Frequently asked questions
What is the cron expression for every 5 seconds?
Why doesn't `*/5 * * * *` run every 5 seconds?
How do I run something every 5 seconds in Spring Boot?
Can Kubernetes CronJob run a job every 5 seconds?
Browse all cron patterns
Every schedule Cronuru documents, with its expression and code snippets for six dialects.