Cron Cannot Do Seconds — Here Is What to Use Instead
Standard (Vixie) cron has five fields and its finest resolution is one minute; there is no seconds field. If you need sub-minute scheduling, the common trick is two crontab lines where the second sleeps, or you switch to a systemd timer which supports seconds natively.
Why there is no seconds field
Cron's five fields are minute, hour, day-of-month, month, day-of-week. The smallest unit is the minute — a 6-field 'cron with seconds' exists only in Quartz (Java) and a few non-standard cron ports, not in system cron.
Run every 30 seconds with two lines
* * * * * /home/me/job.sh* * * * * sleep 30; /home/me/job.sh
The first fires at :00 of each minute, the second waits 30 seconds then fires at :30. Extend the pattern (sleep 15/30/45) for every 15 seconds.
Cleaner: a systemd timer
systemd timers support seconds directly:
[Timer]OnUnitActiveSec=30s
Pair it with a matching .service unit. This is more reliable than the sleep hack and survives missed runs.
Or loop inside a script
For continuous work, a small daemon that loops with sleep 30 and is started once (via @reboot or systemd) avoids cron's minute limit entirely.
FAQ
Can cron run a job every 30 seconds?
Not directly — cron's minimum resolution is one minute. Use two crontab lines where the second runs sleep 30 first, or use a systemd timer with OnUnitActiveSec=30s.
Does cron have a seconds field?
Standard Vixie cron does not; it has five fields down to the minute. Six-field schedules with seconds exist only in Quartz and some non-standard implementations.
What is the best way to run something every few seconds on Linux?
A systemd timer with OnUnitActiveSec, or a long-running script that loops with sleep, is more reliable than stacking cron lines with sleep.