Why every field is a wildcard
An asterisk means "match every value of this field". With all five set to * there is
nothing left to filter on, so the job is due at the top of every minute. Cron has no seconds field, so
this is the highest frequency the syntax can express — roughly 43,800 runs a month.
Using it
In a user crontab:
* * * * * /usr/local/bin/healthcheck.sh >> /var/log/healthcheck.log 2>&1
In a Kubernetes CronJob:
spec:
schedule: "* * * * *"
concurrencyPolicy: Forbid
Note concurrencyPolicy: Forbid. At one-minute intervals overlapping runs are a real
risk, and this is the single most important setting to get right.
Guard against overlap
Plain cron will happily start a second copy of a job while the first is still running. At a one-minute cadence a job that occasionally takes ninety seconds will pile up until the machine falls over. Wrap the command in a lock:
* * * * * /usr/bin/flock -n /tmp/myjob.lock /usr/local/bin/myjob.sh
The -n flag makes flock exit immediately if the lock is held, so a slow run
simply skips the next tick instead of queueing behind it.
When you probably want something else
- You need sub-minute timing. Cron cannot do it. Use a systemd timer with
OnUnitActiveSec, or a long-running worker process. - The job is only relevant during working hours.
* 9-17 * * 1-5cuts the run count by more than 80 per cent for the same coverage. - The job polls an external API. One request a minute from every instance adds up fast; check the rate limit before committing to this schedule.
- The job is cheap but noisy. Every run emails its output to the crontab owner
unless you redirect it. Set
MAILTO=""at the top of the crontab or redirect explicitly, or you will generate 1,440 emails a day.
Variations
| Expression | Runs |
|---|---|
| * * * * * | Every minute, always. |
| * 9-17 * * 1-5 | Every minute during business hours on weekdays. |
| * * * * 1-5 | Every minute, Monday to Friday only. |
| */2 * * * * | Every other minute — half the load, usually indistinguishable. |
| 0-29 * * * * | Every minute in the first half of each hour only. |