Cron every 6 months: 0 0 1 */6 *
0 0 1 */6 * runs twice a year, on the first of January and the first of July. Six months apart, with the step starting from January.
At a glance
- Expression
- 0 0 1 */6 *
- Fires
- 2 times a year.
- Restricted fields
- Month stepped by 6, day of month pinned to 1, minute and hour pinned. Day of week open.
- Equivalent macro
- None.
- Months matched
- 1 and 7. January and July.
- Other pairings
- 4/6 gives April and October. A list such as 3,9 gives March and September.
In detail
A step of six in the month field produces exactly two values, January and July, because the next candidate is month 13 and the field ends at 12. That makes this the half yearly schedule, evenly spaced, with six months between runs in both directions.
Two runs a year is about as infrequent as cron is useful for. Certificate rotation reminders, archive sweeps, credential reviews and licence renewals all sit around here. What they have in common is that nobody is watching, so the job has to make its own noise: write a record, send a message, or leave something a monitoring check can see.
The default pair is January and July, which for many organisations is exactly wrong, because January is a holiday period and July is a holiday period. 4/6 moves the pair to April and October, and an explicit list such as 3,9 gives March and September. All three are two runs a year, six months apart.
With this cadence, the risk is not that the job fails but that it stops being correct. Six months is long enough for a path to change, a credential to be rotated, or a dependency to be removed, and none of that is discovered until the run. Anything on a half yearly schedule benefits from being exercised in a test environment more often than it runs in production.
Examples
0 0 1 */6 *0 0 1 4/6 *0 3 1 3,9 * /opt/app/bin/rotate-credentials.sh >> /var/log/rotate.log 2>&1Things that catch people out
- The step cannot be shifted by adding to it. 0 0 1 */6 * is always January and July, and 4/6 is the form that moves it.
- Six months between runs is long enough for the script to have rotted. Test it on a schedule that is not the production one.
- Two runs a year means a missed run is half your coverage. Record every run somewhere a check can read.
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 quarter: 0 0 1 */3 *
0 0 1 */3 * runs on the 1st of January, April, July and October, four times a year. Shift it with 2/3 for a fiscal year starting in February.
Cron once a year: 0 0 1 1 * with @yearly and @annually
0 0 1 1 * runs at midnight on 1 January, once a year, and is what both @yearly and @annually expand to. Any date works, not just January.
Cron every 2 months: 0 0 1 */2 * and the odd month set
0 0 1 */2 * fires on the 1st of January, March, May, July, September and November. Use 0 0 1 2/2 * for the even months instead.
The cron month field: 1 to 12 with JAN to DEC aliases
The month field runs 1 to 12 and also accepts the three letter names JAN through DEC, case insensitively, including inside ranges and steps.
Cron on 29 February: 0 0 29 2 * and the leap year rule
0 0 29 2 * runs only when 29 February exists, roughly once every four years. The century rule means 2100 has no leap day at all.
Cron at a random time each day: jitter without a random field
Cron has no random field, so jitter is added in the command. A leading sleep of a random number of seconds spreads a fleet across a window.
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