Cron Expression for Every 30 Seconds
Cron does not support seconds. Use two entries or a scheduler.
Why Cron Cannot Do This
Standard cron has five fields: minute, hour, day-of-month, month, and day-of-week. The smallest granularity is one minute. There is no seconds field.
Workaround: Two Cron Entries
You can approximate every-30-seconds by combining two entries in your crontab:
* * * * * /your/command
* * * * * sleep 30 && /your/command
The first runs at the top of each minute. The second sleeps 30 seconds, then runs the same command — giving you two executions per minute, 30 seconds apart.
Better Alternatives
- systemd timers — support sub-second precision on Linux
- Node.js / Python schedulers — use
setIntervalorAPScheduler - Kubernetes CronJob — pair with a sidecar loop for sub-minute intervals
Try the Cron Expression Builder to create and test cron schedules.