Developer guide

Cron Every N Seconds: The 6-Field Format, Explained

The five-field cron you learned in school can't go faster than once a minute. When a health-check, queue-drain or heartbeat needs to run every few seconds, you need the extended 6-field format — but it is not supported everywhere. Here is exactly when it works, how to write it, and what to do on a normal Linux server.

Benjamin Rotshtein

Written by Benjamin Rotshtein

Updated

Can cron run a job every few seconds?

Standard 5-field cron cannot — its smallest unit is one minute. Only extended 6-field (Vixie-style) implementations accept a leading seconds field, so */10 * * * * * runs every 10 seconds. On a normal Linux server the reliable replacement is a sleep loop or a dedicated scheduler like node-cron, Spring or n8n that natively understands seconds.

Can cron run every few seconds?
Only with a 6-field (Vixie-style) expression like */10 * * * * * — standard 5-field cron is capped at one minute.
What is the 6-field order?
Second, minute, hour, day-of-month, month, day-of-week — a leading seconds field before the familiar five.
Why does it fail on my Linux box?
Vixie cron, cronie and most crontab parsers only accept five fields. The seconds extension lives in libraries and schedulers, not the system daemon.

The one-minute barrier of standard cron

The classic five-field expression */5 * * * * means “every 5 minutes,” not every 5 seconds. That is the design: cron was built for maintenance jobs, not high-frequency work. Trying to fake seconds with * * * * * gives you a run at the start of every minute, which is not a 1-second cadence at all.

The 6-field (Vixie) format

The extended syntax adds a seconds field at the front:

#  second  minute  hour  day-of-month  month  day-of-week
     */10     *      *         *          *         *      # every 10 seconds
       0      */15   *         *          *         *      # every 15 minutes
       *      *      *         *          *         *      # once per second

Everything you already know about the other five fields still applies — ranges, lists, steps and ? placeholders (in quartz-style parsers) all work the same.

Where the seconds field actually works

ExpressionMeaningSupported by
* * * * * *Every secondOnly 6-field daemons
*/10 * * * * *Every 10 secondsOnly 6-field daemons
0 */15 * * * *Every 15 minutes6-field daemons (also valid 5-field)
0 0 * * * *Every hour6-field daemons (also valid 5-field)
*/5 * * * *Every 5 minutesStandard 5-field cron

The system crontab on Linux and macOS does not support the seconds field. It shows up in in-process schedulers instead: Python croniter and the crontab library, Go's robfig/cron, Node.js node-cron with a seconds flag, and every quartz-based scheduler (Java Spring, and similar).

The right tool for sub-minute cadence

If your daemon only speaks five fields, a sleeping loop is the honest replacement:

while true; do
  your_script.sh
  sleep 10
done

Run that as a systemd unit with Restart=always and it survives reboots and crashes. In Node.js the equivalent is a setInterval, in Go a time.Ticker. Add a lock so a slow run never overlaps the next tick.

Generate a valid expression

For the cadences cron is designed for — every minute and up — the Cron Generator turns plain English into a correct 5-field expression and previews the next runs, so you never misplace a field again.

Frequently asked questions

Can cron run a job every 5 seconds?

The standard 5-field cron cannot — its minimum resolution is one minute. Only extended (6-field, Vixie-style) cron implementations accept a seconds field as the first position, e.g. */5 * * * * * runs every 5 seconds. Support varies by daemon and crontab parser.

What is the 6-field cron syntax?

It adds a leading seconds field: second minute hour day-of-month month day-of-week. So */30 * * * * * means every 30 seconds; 0 */15 * * * * means every 15 minutes; and * * * * * * runs once every second.

Why won't my 6-field expression work on Linux cron?

Standard Vixie cron and most Linux daemons (cronie, crontab -e) only understand 5 fields and reject a 6-field line or silently treat the first number as the minute. The seconds field works in cron implementations like the Go crontab library, Python's croniter/crontab modules, and the quartz-based schedulers (Java/Node job schedulers).

How do I run a job every 10 seconds on a normal server?

If your daemon lacks a seconds field, the reliable approach is a long-running loop: a while loop with sleep 10 inside systemd, a Node setInterval, or a Go ticker. Cron alone is usually the wrong tool for sub-minute cadence.

Is there any risk in scheduling a job every second?

Yes. A 1-second cadence can hammer your database, fill logs, and overlap runs if the job takes longer than the interval. Use a locking mechanism and always prefer the slowest cadence that satisfies the requirement.

What is the difference between */5 * * * * and */5 * * * * *?

The first is a standard 5-field expression meaning every 5 minutes. The second adds a leading seconds field (6-field Vixie syntax) meaning every 5 seconds. The extra * changes both the meaning and the set of schedulers that accept the line.

Related guides