- Home
- Tools
- Developer Tools
- Cron Expression Explainer
- Cron Expression for Every Minute
Cron Expression for Every Minute
* * * * * runs a job once a minute, the shortest interval cron has. See the next run times, and what to do when a run takes longer than that.
Every minute
| Field | Value | Matches |
|---|---|---|
| Minute | * | every minute |
| Hour | * | every hour |
| Day of month | * | every day of the month |
| Month | * | every month |
| Day of week | * | every day of the week |
Next 10 runs
Cron goes by the clock of the machine it runs on. These are the runs on a machine in your time zone.
Five stars
* * * * * leaves every field open: any minute, any hour, any day. The job runs 1,440 times a day, and that is as often as cron can do it.
| Expression | Runs |
|---|---|
| * * * * * | Every minute |
| */2 * * * * | Every 2 minutes |
| * 9-17 * * 1-5 | Every minute from 09:00 to 17:59 on Monday to Friday |
| * * * * * * | Every second |
Shorter than a minute
Cron looks at the clock once a minute, so no five-field expression means "every 30 seconds". The usual way round it is two lines, of which the second waits first:
* * * * * /path/to/job
* * * * * sleep 30; /path/to/job
Schedulers that take six fields, such as Quartz and Spring, have a seconds field in front. This page reads those too, as the last row of the table shows.
When a run takes longer than a minute
Cron does not wait for the previous run to finish. If the job sometimes needs more than a minute, the next one starts beside it, and on a busy machine slow runs pile up. On Linux, flock lets a run start only when the previous one has let go of the lock:
* * * * * flock -n /tmp/job.lock /path/to/job
The cron expression explainer has the full syntax: the five fields, lists, ranges and steps, and how day of month and day of week work together.