Cron every second: * * * * * * with a seconds field
A six field expression adds a leading seconds field, so * * * * * * matches every second, 86,400 times a day. The crontab daemon itself does not accept six fields.
At a glance
- Expression
- * * * * * *
- Fires
- 86,400 times a day, 3,600 times an hour, 60 times a minute.
- Restricted fields
- Nothing. All six fields are open.
- Equivalent macro
- None. Every macro expands to a five field expression, so no macro can reach second resolution.
- Field count
- Six. The leading field is seconds, range 0 to 59.
- Where it works
- Application level schedulers that accept a seconds field, not the system crontab.
In detail
The parser decides how to read an expression by counting tokens. Five tokens means minute, hour, day of month, month and day of week. Six means a seconds field has been prepended, and every later field shifts one place to the right. So * * * * * * matches every second of every minute of every hour, which is 86,400 matches a day.
That form is not something you can put in a system crontab. The Unix cron daemon reads five fields and treats a sixth as the start of the command, so pasting six asterisks there produces a job that runs every minute and tries to execute a program called *. Six field expressions belong to schedulers embedded in applications, where the same syntax was extended rather than replaced.
At one run a second the question is not how to schedule it but whether scheduling is the right model at all. A task that fires every second is a loop with extra steps, and running it as a loop gives you a warm process, a connection you do not reopen 86,400 times a day, and somewhere sensible to put backoff when the thing you are polling is down.
If you do need per second work from a cron style expression, restrict the other fields hard. Every second for one minute an hour is a very different load profile from every second forever, and the six field form makes that easy to say precisely.
Examples
* * * * * ** 0 * * * *Sixty runs an hour, 1,440 a day, all inside minute 0.
* * * * *Every minute. Five tokens, not six.
Things that catch people out
- Six fields in a system crontab is a silent misconfiguration, not an error. The sixth token is taken as the command.
- Counting tokens by eye is unreliable when the fields are all asterisks. Paste the expression into the parser and read the field breakdown to see whether it found five or six.
- Anything that logs one line per run at this rate produces over 86,000 lines a day per job. Plan the rotation before enabling it.
Try it: Cron Expression Parser
Paste any five or six field expression to get a plain English description, a per field breakdown and the next run times in your local time.
Cron Expression Parser
LOCAL · Browser-OnlyParse cron expressions and see the next scheduled run times
Supports 5-field (minute hour day month weekday), 6-field (with seconds), named values (JAN, MON), and @macros (@daily, @hourly, ...)
Use the dropdowns below to build your cron expression visually, or type a custom value in each field.
Human-Readable Description
Every 5 minutes
Field Breakdown
| Field | Allowed | Value | Meaning |
|---|---|---|---|
| Minute | 0-59 | */5 | every 5 minute(s) |
| Hour | 0-23 | * | every hour |
| Day of Month | 1-31 | * | every day of month |
| Month | 1-12 | * | every month |
| Day of Week | 0-7 | * | every day of week |
Related cron expressions
All cron expressions →Cron every 10 seconds: */10 * * * * * and the alternative
*/10 * * * * * fires 8,640 times a day at seconds 0, 10, 20, 30, 40 and 50. What to do when the scheduler only accepts five fields.
Cron every 30 seconds: */30 * * * * * and the two line trick
*/30 * * * * * fires at seconds 0 and 30, 2,880 times a day. The classic two line crontab with sleep 30 does the same thing without a seconds field.
The cron seconds field: the optional sixth position
A six field expression puts seconds first and shifts everything right. The system crontab has no seconds field, so six fields there means a broken job.
Cron every minute: * * * * *
* * * * * fires 1,440 times a day, once at the top of every minute. Why it is the fastest a five field crontab goes, and how to stop runs stacking.
Cron every hour: 0 * * * *
0 * * * * fires 24 times a day at the top of every hour and is what @hourly expands to. Why * */1 * * * is the mistake people make instead.
Cron every hour at 30 minutes past: 30 * * * *
30 * * * * runs 24 times a day at half past every hour. How to pick an offset minute deliberately and why the top of the hour is worth avoiding.
Tools for this
- Cron Expression Parser Free online cron expression parser - parse cron expressions and see the next scheduled run times
- Crontab Generator Free online crontab generator - build cron expressions visually with an intuitive interface