Cron every 15 days: 0 0 */15 * * gives days 1, 16 and 31
0 0 */15 * * matches days 1, 16 and 31. That gives three runs in a 31 day month and two in every other month, 31 runs a year rather than 24.
At a glance
- Expression
- 0 0 */15 * *
- Fires
- 3 times in a 31 day month, 2 in every other month, 31 times a year.
- Restricted fields
- Day of month stepped by 15, minute and hour pinned. Month and day of week are open.
- Equivalent macro
- None.
- Days matched
- 1, 16 and 31.
- Gap pattern
- 15 days, 15 days, then a single day into the next month.
In detail
Fifteen steps twice inside a 31 day month: from 1 to 16, and from 16 to 31. The third value only exists in the seven months that reach 31 days, so the schedule alternates between two runs and three depending on the month, which is not what anyone means by every fifteen days.
The consequence is the day 31 run followed immediately by the day 1 run. Two runs one day apart, seven times a year, in a schedule whose whole point was a fortnightly gap. If the job charges something, sends something or archives something, those pairs are the ones that will be noticed.
The fix, if what you wanted was twice a month, is to say so directly with 0 0 1,16 * *. That drops the 31st, gives exactly 24 runs a year, and makes the intent readable. It is one character longer than the step form and removes the entire class of surprise.
If what you wanted was a genuine fifteen day interval, no combination of cron fields will produce it, because 15 does not divide any month length and the field resets monthly. That needs the same epoch arithmetic guard as a fortnightly schedule: run daily and test the epoch day count modulo 15.
Examples
0 0 */15 * *Days 1, 16 and 31. Three runs in seven months of the year.
0 0 1,16 * *Exactly 24 runs a year.
0 0 * * * [ $(( $(date +\%s) / 86400 \% 15 )) -eq 0 ] && /opt/app/bin/job.shThings that catch people out
- The 31st and the 1st are consecutive runs. That happens after January, March, May, July, August, October and December.
- 31 runs a year is not 24 and not 26. If a contract or a billing cycle depends on the count, the step form will not match it.
- 0 0 1,15 * * and 0 0 1,16 * * are different schedules. The first has an uneven gap in February, the second is exactly fifteen days apart within a 31 day month.
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 other day: 0 0 */2 * * and the month reset
0 0 */2 * * runs on odd numbered days, 16 times in a 31 day month. The step resets each month, so the 31st and the 1st are consecutive runs.
Cron every 2 weeks: what cron cannot do and what to write
Cron has no fortnight. The two honest options are a semi monthly 1,15 schedule or a weekly job with a week parity test in the script.
Cron on the 1st and 15th: 0 0 1,15 * *
0 0 1,15 * * runs on the first and fifteenth of every month, 24 times a year. The gaps run from 13 to 17 days, so it is not a fortnight.
The cron day of month field: 1 to 31 and missing dates
The day of month field runs 1 to 31, and a date that does not exist in a given month simply never matches. Steps start at 1, giving odd days.
Cron on the first day of the month: 0 0 1 * *
0 0 1 * * runs at midnight on the 1st of every month, twelve times a year, and is exactly what the @monthly macro expands to.
Cron on the 31st: 0 0 31 * * only fires seven times a year
0 0 31 * * runs only in months that have 31 days, so it fires seven times a year, not twelve. The same trap hits day 30 and day 29.
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