crontool
Paste a schedule, read it in English, see the next runs.

Running a Job Every 5 Seconds

Cron cannot run a job every 5 seconds — its finest resolution is one minute. To run every 5 seconds, use a per-minute cron job that loops with sleep, or a systemd timer with sub-minute accuracy.

Why cron can't

The cron format has no seconds field; the smallest interval is * * * * * = once a minute. "Every 5 seconds" must be built on top of that.

The sleep-loop pattern

Run a wrapper once a minute that fires 12 times, 5 seconds apart:

* * * * * for i in $(seq 0 5 55); do (sleep $i; /path/job.sh) & done

Each subshell sleeps then runs, giving executions at 0,5,10…55 seconds.

Better: systemd timer

A timer with OnUnitActiveSec=5s runs every 5 seconds cleanly and logs each run. For true high-frequency work, a long-running daemon is more reliable than spawning processes.

FAQ

Can cron run every 5 seconds?

No — cron's smallest unit is one minute. Use a per-minute job with a sleep loop, or a systemd timer with OnUnitActiveSec=5s.

What's the cron sleep trick for sub-minute intervals?

* * * * * for i in $(seq 0 5 55); do (sleep $i; /path/job.sh) & done runs the job every 5 seconds within each minute.

What's the best way to run something every few seconds?

A systemd timer with OnUnitActiveSec, or a long-running daemon. Spawning a process every few seconds from cron is fragile for real workloads.