Run a cron job every 10 seconds
crontab has no exact expression for “Every 10 seconds”. Here is why, a workaround, and the platforms that can do it. crontab is the classic Unix scheduler: five time fields and a command, in the server’s time zone.
Why crontab can’t do this exactly
Defined on Quartz as */10 * * * * ? · “Every 10 seconds”
second: crontab has no seconds field, so it cannot run at seconds other than 0.
WorkaroundRun every minute and repeat inside the job with sleep, or use a scheduler that has seconds (Spring, Quartz, a systemd timer).
crontab gotchas
FAQ
What is the crontab cron expression for “Every 10 seconds”?
There is none that matches exactly. crontab has no seconds field, so it cannot run at seconds other than 0.
Which time zone does a crontab schedule use?
In the server’s local time zone. cronie reads a CRON_TZ= line for the entries below it; check which cron your system runs before you rely on it.
How do I edit my crontab?
Run crontab -e to edit and crontab -l to list. Each line is five time fields followed by the command.
Is Sunday 0 or 7 in crontab?
Both. crontab accepts 0 and 7 for Sunday, and names such as SUN.