buildcron

Cron Expression for Every Other Day

The usual cron expression for every other day is 0 0 */2 * *, which runs at midnight on the 1st, 3rd, 5th and every other odd-numbered day of the month. It's close to every 48 hours, but not exact: the pattern restarts on the 1st of each month.

CRON → ENGLISH
0 minute0 hour*/2 day of month* month* day of week
VALID EXPRESSION

At 12:00am on day 1, 3, 5, 7, 9 and 11 more of the month.

0 0 */2 * *

Standard 5-field crontab syntax. Day of month and day of week are OR'd when both are set.

NEXT 5 RUN TIMES · local time

What it does

The step sits in the day of month field. */2 counts through 1–31 in steps of two from the first value, giving 1, 3, 5 … 31, and 0 0 sets the time to midnight. Cron doesn't remember when the job last ran; it simply checks whether today's date is one of those odd numbers.

That's why the rhythm slips at the end of some months. A 31-day month runs on the 31st and again on the 1st, two days in a row, and so does February in a leap year, when the 29th is followed by 1 March. In 30-day months and ordinary Februaries the gap stays at two days. For backups, cleanup jobs or reports that just need to happen roughly every other day, that's usually fine.

If the job must run exactly every 48 hours — a billing cycle, say — schedule it daily and let the command skip alternate days by counting days since the Unix epoch: 0 0 * * * [ $(( $(date +\%s) / 86400 \% 2 )) -eq 0 ] && /path/to/job. The epoch-day count never resets, so the job runs every second day indefinitely.

How 0 0 */2 * * works, field by field

FIELDVALUEMEANING
Minute0minute 0
Hour0hour 0 (midnight)
Day of month*/2days 1, 3, 5 … 31 of the month
Month*every month
Day of week*every day of the week

Put together, cron reads 0 0 */2 * * as: “At 12:00am on day 1, 3, 5, 7, 9 and 11 more of the month.

To see further ahead, paste the expression into the cron calculator, which lists the next ten run times and counts how many times the schedule runs in a year.

Frequently asked questions

Why did my every-other-day cron job run two days in a row?

Because */2 in the day of month field restarts every month. After the 31st — or 29 February in a leap year — the next match is the 1st, which is the very next day.

How do I run a cron job on even days of the month instead?

Start the step at 2: 0 0 2-30/2 * * runs on the 2nd, 4th and so on up to the 30th. Even days never run two days in a row, though the gap stretches to three days after a 31-day month.

Is 0 0 */2 * * the same as running every 48 hours?

Not quite — it follows the calendar, so the gap is two days most of the time but one day at the end of 31-day months. For a strict 48-hour interval, run daily and skip alternate days in the command, or use a systemd timer with OnUnitActiveSec=2d.