cronuru
Pattern

Every 20 Seconds

*/20 * * * * *
0/20 * * * * ?

Runs every 20 seconds — at :00, :20, :40 of each minute. Requires a seconds-aware dialect (Spring or Quartz); standard Unix cron is minute-precision only.

Use in your stack

{
  "schedule": {
    "cron": "0/20 * * * * ?",
    "timezone": "UTC"
  }
}
// 6-field: second minute hour day-of-month month day-of-week
@Scheduled(cron = "*/20 * * * * *")
public void everyTwentySeconds() {
    // ...
}

// Simpler for pure intervals — no cron parser needed:
@Scheduled(fixedRate = 20000) // milliseconds
public void everyTwentySecondsFixedRate() {
    // ...
}

Next runs

Pick a timezone to see when this expression fires next.

Next 10 runs
  1. 012026-07-13T16:05:20.000Z
  2. 022026-07-13T16:05:40.000Z
  3. 032026-07-13T16:06:00.000Z
  4. 042026-07-13T16:06:20.000Z
  5. 052026-07-13T16:06:40.000Z
  6. 062026-07-13T16:07:00.000Z
  7. 072026-07-13T16:07:20.000Z
  8. 082026-07-13T16:07:40.000Z
  9. 092026-07-13T16:08:00.000Z
  10. 102026-07-13T16:08:20.000Z

Variations

*/15 * * * * *

Every 15 seconds

*/10 * * * * *

Every 10 seconds

*/30 * * * * *

Every 30 seconds

Common use cases

  • Polling a moderately active queue or message broker.
  • Refreshing a live metric or status panel during development.
  • Sub-minute health checks with a 20-second detection window.
  • Periodically flushing a small buffer to a downstream system.

Gotchas

  • **Unix crontab cannot do this.** The 5-field format has no seconds field; its minimum is `* * * * *` (every minute). Kubernetes CronJob and GitHub Actions inherit the same limit.
  • In Spring, `*/20 * * * * *` is the 6-field form (seconds first). Don't confuse it with Unix's 5-field `*/20 * * * *`, which means every 20 *minutes*.
  • In Quartz, use `0/20 * * * * ?` — the `0/20` seconds field means "starting at second 0, every 20 seconds," and `?` fills the unused day-of-week field.
  • For a pure interval, a `fixedRate`/`fixedDelay` loop is simpler than a cron parser. Use `@Scheduled(fixedRate = 20000)` in Spring or `tokio::time::interval` in Rust.
  • Because 60 divides evenly by 20, the runs land cleanly at :00, :20, :40 — no drift within the minute.

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 20 seconds” isn’t expressible. The finest you can schedule is once a minute.

To go sub-minute you need a 6-field, seconds-first dialect:

For an interval this tight, a plain timer is usually the better tool. Spring’s @Scheduled(fixedRate = 20000) and Rust’s tokio::time::interval(Duration::from_secs(20)) both express “every 20 seconds” without a cron parser — and they’re easier to reason about when a run might overrun its window. See also every 15 seconds and every 30 seconds.

Frequently asked questions

What is the cron expression for every 20 seconds?
In a seconds-aware dialect, every 20 seconds is `*/20 * * * * *` (Spring) or `0/20 * * * * ?` (Quartz). Standard Unix/crontab has no seconds field, so it cannot schedule every 20 seconds — its finest granularity is one minute (`* * * * *`).
Why doesn't `*/20 * * * *` run every 20 seconds?
`*/20 * * * *` is a 5-field Unix expression, and its first field is minutes — so it runs every 20 *minutes*. Unix cron has no seconds field. To get every 20 seconds you need a 6-field dialect where the first field is seconds, such as Spring (`*/20 * * * * *`) or Quartz (`0/20 * * * * ?`).
How do I run something every 20 seconds in Spring Boot?
Two options. With cron syntax: `@Scheduled(cron = "*/20 * * * * *")`. Or, more simply, with a fixed rate: `@Scheduled(fixedRate = 20000)` (the value is milliseconds). Use `fixedDelay = 20000` instead if each run should wait for the previous one to finish before the timer restarts.
Can Kubernetes CronJob run a job every 20 seconds?
No. Kubernetes CronJob uses the standard 5-field cron format with a one-minute minimum, so the fastest it schedules is once per minute. For sub-minute work, run a long-lived Deployment with an internal loop (e.g. `sleep 20`) or a language-level timer instead of a CronJob.

Browse all cron patterns

Every schedule Cronuru documents, with its expression and code snippets for six dialects.