cronkit.org
Cron expressions, explained and converted — in your browser

Cron tools › Platforms

Celery crontab() converter

cron line ⇄ crontab() · keyword arguments · beat_schedule

Convert a Linux cron line into crontab(minute=…, hour=…, …) for celery beat, or paste an existing crontab() call to see the cron line it stands for and when it runs. Positional arguments, the classic source of wrong schedules, are called out.

Python

Next runs

How to convert a cron line to Celery crontab()

  1. Paste the cron line (minute hour day-of-month month day-of-week) under cron line → crontab().
  2. Copy the crontab(…) call. It always uses keyword arguments, so the order cannot bite.
  3. If the line sets both a day of the month and a weekday, you get two calls: Linux cron runs when either matches, Celery only when both do.
  4. Set the task name and entry name, then copy the beat_schedule block into your Celery configuration.
  5. To read an existing schedule, switch to crontab() → cron line and paste the call; strings, whole numbers and lists of numbers are understood.
  6. Pick the time zone your Celery app uses (UTC unless configured) to see the right run times.

The argument-order trap

A cron line lists the day fields as day-of-month, month, day-of-week. crontab() takes its arguments in a different order, with day_of_week third:

PositionCron line fieldcrontab() argument
1minuteminute
2hourhour
3day of monthday_of_week
4monthday_of_month
5day of weekmonth_of_year

So crontab('0', '0', '1') is not "midnight on the 1st": it is midnight every Monday. Keyword arguments remove the problem. crontab.from_string('0 0 1 * *'), on the other hand, reads the cron-line order.

Where Celery differs from Linux cron

Other languages and schedulers for the same line are on cron to code.

FAQ

Why does my Celery task run on Mondays instead of the 1st?

You probably wrote crontab(0, 0, 1). The third positional argument is day_of_week, and 1 is Monday. Write crontab(minute=0, hour=0, day_of_month=1).

How do I say "the 1st of the month or every Monday" in Celery?

With two beat entries, one with day_of_month='1' and one with day_of_week='1'. In one crontab() both would have to match. Paste 0 0 1 * 1 above to get both entries.

Is Sunday 0 or 7 in Celery?

0 (or sun). Celery raises on 7, unlike Linux cron, where 7 is also Sunday.

Which time zone does celery beat use?

UTC by default. If your app sets app.conf.timezone, pick the same zone here to see the real run times; the generated beat_schedule includes that setting when the zone is not UTC.