Skip to content

Scheduling ​

schedule starts runs at cron times or at one-off timestamps. The scheduler process fires them: it runs inside dagu start-all, or alone with dagu scheduler. Each fire is a slot with a scheduled time and a window back to the previous fire, which the run can read.

yaml
working_dir: .
schedule: "0 2 * * *"      # every day at 02:00
steps:
  - id: load
    run: ./load.sh

working_dir: . runs ./load.sh from the DAG file's folder; without it, steps run in a fresh directory per run. See Working Directory. The workflow page's Cron launcher lists the next runs before the first one fires. See Preview Upcoming Runs.

How a Schedule Fires ​

  • Every minute. The scheduler checks the schedules on each whole minute.
  • One scheduled run at a time. A fire that comes while the DAG has a running or queued run is skipped, as at 11:00 on an hourly schedule.
  • Missed slots. Fires that pass while no scheduler runs, the DAG is suspended, or the scheduler is paused are not run, unless catchup_window replays them. Here catchup_window: 6h replays 12:00 and 13:00 when the scheduler restarts at 13:30.
  • Zone. A cron expression without a zone prefix is read in the server's tz, or the host's local time when it is unset.

Cron Expressions ​

A cron expression has five fields: minute, hour, day of month, month, and day of week.

ExpressionFires
0 2 * * *Every day at 02:00
*/15 * * * *Every 15 minutes
0 9 * * MON-FRIWeekdays at 09:00
*/30 8-17 * * MON-FRIEvery 30 minutes from 08:00 to 17:30 on weekdays
0 0 1 * *Midnight on the first day of each month

A step that does not divide its field evenly, such as */33 in the minute field, fires at :00 and :33, not every 33 minutes. The DAG loads with a warning that names the divisors that work.

Schedule Aliases ​

AliasEquivalent cronFires at
@hourly0 * * * *The start of each hour
@daily, @midnight0 0 * * *Midnight each day
@weekly0 0 * * 0Midnight on Sunday
@monthly0 0 1 * *Midnight on the first day of each month
@yearly, @annually0 0 1 1 *Midnight on January 1

Aliases are case-sensitive and must be quoted in YAML. They work wherever a cron expression does, with a zone prefix such as "CRON_TZ=Asia/Tokyo @daily". The API and the schedule badges show the equivalent cron expression; the YAML keeps the alias.

"@every 90m" fires once per interval on a grid aligned to the Unix epoch. The interval must be a whole number of minutes, and @every takes no zone prefix.

Multiple Schedules ​

yaml
working_dir: .
schedule:
  - "0 9 * * MON-FRI"   # weekdays at 09:00
  - "0 14 * * SAT,SUN"  # weekends at 14:00
steps:
  - id: sync
    run: ./sync.sh

When several entries fire in the same minute, the DAG gets one run.

Time Zones ​

Prefix an expression with CRON_TZ= or TZ= and a tz database name:

yaml
working_dir: .
schedule: "CRON_TZ=Asia/Tokyo 0 9 * * *"   # 09:00 in Tokyo
steps:
  - id: report
    run: ./report.sh

The prefix applies to that expression only and does not set TZ for the steps. Without a prefix, schedules use the server's tz.

One-Off Runs ​

An at entry runs the DAG once at a timestamp:

yaml
working_dir: .
schedule:
  - "0 9 * * MON-FRI"
  - at: "2026-03-29T09:30:00+09:00"
steps:
  - id: migrate
    run: ./migrate.sh
  • The timestamp is RFC 3339 with an offset or Z, and seconds of :00.
  • After it fires, Dagu marks it consumed, so it never fires again.
  • at entries go in a top-level schedule list or under schedule.start, with or without kind: at. Stop and restart schedules do not take them.
  • A one-off whose time passes while the scheduler is paused fires once it resumes.

Start, Stop, and Restart ​

For a long-running DAG, stop stops the active run at set times:

yaml
working_dir: .
schedule:
  start: "0 8 * * *"      # start at 08:00
  stop: "0 18 * * *"      # stop at 18:00
steps:
  - id: consumer
    run: ./consume-events.sh

Each of start, stop, and restart takes one expression or a list. stop and restart are cron only.

Restart Schedule ​

restart stops the active run and starts a new one, waiting restart_wait_sec in between:

yaml
working_dir: .
schedule:
  start: "0 8 * * *"
  restart: "0 12 * * *"   # restart at noon
  stop: "0 18 * * *"
restart_wait_sec: 60
steps:
  - id: consumer
    run: ./consume-events.sh

To keep a DAG running without a schedule, starting a new run whenever one ends, use restart_policy.

Parameters per Schedule ​

A start entry, recurring or one-off, can set params for the runs it starts. Keys it leaves out keep the DAG's defaults:

yaml
working_dir: .
params:
  mode: full
  region: us
schedule:
  - expression: "0 5 * * *"
    params: {mode: incremental}
  - expression: "0 23 * * SUN"
    params: {mode: full, region: eu}
steps:
  - id: sync
    run: ./sync.sh --mode "${params.mode}" --region "${params.region}"

The values are literal and are checked against params when the DAG loads, so a value outside an enum fails validation.

  • Scheduled and catch-up runs use the entry that fired. When several fire at once, a due one-off entry wins, then the first matching recurring entry in YAML order.
  • Backfill runs use the recurring entry that fires at their slot, unless the backfill passes --params.
  • Retries reuse the run's saved inputs. Manual starts use their own inputs and the defaults.

The Cron launcher shows a field for each named parameter under each plain entry, with the default in grey. A value is saved to the entry's params when the field loses focus; emptying the field or the reset button removes it. Entries with calendar, profile, or at keep their params in the YAML only.

Profile-Scoped Schedules ​

profile makes an entry active only where the DAG's default runtime profile matches it:

yaml
working_dir: .
schedule:
  - expression: "*/20 * * * *"
    profile: prod
  - expression: "30 */2 * * *"
    profile: dev
steps:
  - id: sync
    run: ./sync-data.sh

The default runtime profile comes from the server-side DAG settings. Unscoped entries are always active, and a DAG with no default profile ignores scoped entries. profile only filters entries; it does not choose the profile of the run.

Business Days ​

Name a business calendar to skip holidays, and add business_days to keep chosen business days of each month:

yaml
working_dir: .
calendar: weekdays            # built in: Monday to Friday, no holidays
schedule:
  - "0 9 * * *"               # every business day at 09:00
  - expression: "0 18 * * *"
    business_days: [1, -1]    # first and last business day of the month
steps:
  - id: report
    run: ./report.sh

A fire that falls on a holiday is dropped, not moved.

Preview Upcoming Runs ​

Select the Cron launcher on the workflow canvas to list the next runs of the start schedules: five, then up to ten with Show more. The list follows the YAML as it changes, reads each run in its schedule's zone, and names the holidays a calendar skipped.

Cron launcher with two schedule entries, a parameter field for each, and the upcoming runs, one noting a skipped bank holidayCron launcher with two schedule entries, a parameter field for each, and the upcoming runs, one noting a skipped bank holiday

The list comes from the definition alone. When the DAG is suspended or the scheduler is paused, the launcher says that none of the listed runs will start.

The same list is upcomingRuns in the DAG details API and in the MCP dagu_read result for a DAG. On the command line, dagu calendar fires <DAG> lists the next fires, and dagu ls -n shows each DAG's next run.

Skip Redundant Runs ​

skip_if_successful skips a scheduled run when the DAG already succeeded since the previous scheduled time, for example after a manual run:

yaml
working_dir: .
schedule: "0 * * * *"
skip_if_successful: true
steps:
  - id: sync
    run: ./sync.sh

Manual runs always run.

Catchup (Missed Run Replay) ​

With catchup_window, a scheduler that starts after downtime replays the slots it missed within the window, oldest first:

yaml
working_dir: .
schedule: "0 * * * *"
catchup_window: "6h"
overlap_policy: all
steps:
  - id: hourly_job
    run: ./hourly-job.sh

If the scheduler was down from 10:00 to 14:00, it replays 10:00, 11:00, 12:00, and 13:00, then the 14:00 slot.

  • Queues must be enabled (queues.enabled, true by default). Catch-up runs go through the DAG's queue. With queues off, the scheduler logs a warning and replays nothing.
  • One slot per minute. The scheduler queues one replayed slot per tick, and only while the DAG has no running or queued run. Catch-up goes before the live schedule.
  • Window. A Go duration with d for days, such as 30m, 6h, or 2d12h. Replay starts from the latest of now minus the window, the scheduler's last tick, and the DAG's last scheduled slot. Omitted or zero: no replay.
  • At most 1,000 missed slots per DAG, the newest ones.
  • No duplicates. A slot's run ID is derived from the DAG and the slot time, so a slot that already has a run, live or replayed, is not run again, even across restarts.

overlap_policy decides what happens to a replayed slot that is due while the DAG is still busy:

overlap_policyReplayed slot while the DAG is busy
skip (default)Dropped; the next slot is tried on the next tick
allKept and tried again on the next tick, so every slot runs in order
latestEvery slot but the newest is dropped, and only that one runs

A scheduler that takes over from a failed one replays slots missed in the last scheduler.failover_recovery_window (2 minutes by default), even without catchup_window. See Scheduler High Availability.

Running a Past Slot ​

To run a slot again, for example after fixing a bug, start a run for it:

bash
dagu start --scheduled-at latest etl.yaml
dagu start --scheduled-at 2026-11-09 etl.yaml               # the only fire that day
dagu start --scheduled-at 2026-11-09T02:00 etl.yaml         # in the schedule's zone
dagu start --scheduled-at 2026-11-09T02:00:00+09:00 etl.yaml

The run gets the scheduled time, window, and dates that the scheduled run of that slot got, so the DAG needs no date parameters. dagu enqueue --scheduled-at, the scheduleTime field of the start and enqueue API and of the MCP execute tool, and Scheduled at in the run dialog do the same.

  • A slot later than now is refused. dagu dry --scheduled-at accepts one and prints the slot and its window.
  • A date names the only fire of that day. A schedule that fires zero or several times that day fails the command, which lists the fires.
  • A time without an offset is read in the schedule's zone. If the schedules use different zones, give an offset.
  • A time that is not a fire time is accepted with a warning naming the nearest fires.
  • The run is manual. It never stands in for the scheduled run of its slot.
  • Reruns keep the slot. dagu restart, dagu start --from-run-id, and Retry as a new run use the historic run's slot. A child DAG takes its parent's slot.

To run every slot of a range, skipping those that already ran, use a backfill.

Scheduler Process ​

High Availability ​

Several schedulers can share one data directory and DAG directory on shared storage. One holds a directory lock and runs the schedules; the others wait as standbys and take over when it stops, within about 5 seconds after a clean stop, or once the lock goes stale (30 seconds by default) after a crash. See Scheduler High Availability for storage requirements and setup.

dagu scheduler serves GET /health on scheduler.port (8090 by default; 0 disables it). The response's role is active or standby, and /health?role=active answers 503 on a standby. dagu start-all does not serve it.

Zombie Detection ​

A run whose status says running but whose process died, after kill -9, a crash, or an out-of-memory kill, is a zombie. Each run process writes a heartbeat file every proc.heartbeat_interval. The scheduler checks running runs every scheduler.zombie_detection_interval, and marks a run failed after scheduler.failure_threshold checks in a row find its heartbeat older than proc.stale_threshold. The run is not resumed; a DAG-level retry_policy can run it again.

yaml
# config.yaml (defaults shown)
proc:
  heartbeat_interval: "5s"
  stale_threshold: "90s"
scheduler:
  zombie_detection_interval: "45s"   # "0" disables the scheduler's check
  failure_threshold: 3
  • Worst case with the defaults: 90s + 3 × 45s = 225 seconds. Opening the run in the UI or reading it with dagu status repairs it as soon as its heartbeat is stale.
  • Faster detection: heartbeat_interval: 2s, stale_threshold: 20s, and zombie_detection_interval: 10s detect a dead process in about 50 seconds, at the cost of more frequent writes.
  • proc.heartbeat_interval must be less than proc.stale_threshold, or Dagu refuses to start. scheduler.heartbeat_interval and scheduler.stale_threshold are deprecated aliases.
  • Runs on a distributed worker are checked by the coordinator through worker heartbeats instead.

Pausing the Scheduler ​

Pausing the scheduler stops scheduled run creation for every DAG at once, for a maintenance window or an incident, without stopping the process. An administrator pauses and resumes it with Pause and Resume on the System Status page, or through the API:

bash
curl -X POST "http://localhost:8080/api/v1/services/scheduler/pause" \
     -H "Authorization: Bearer $DAGU_API_TOKEN" \
     -H "Content-Type: application/json" \
     -d '{"paused": true, "reason": "database migration"}'

Send {"paused": false} to resume. While paused, a banner on every page shows who paused it and why. The state is stored in scheduler/paused.json under data_dir and survives a restart.

TriggerWhile paused
Schedule, catch-up, automatic retryNo runs are created
ServiceThe active run keeps going; no new run is queued
Watched folderArrived files wait and run after the resume
Manual, webhook, sub-DAGUnaffected
Queue processing, zombie detection, notificationsContinue

A pause discards work as suspending every DAG would:

  • Queued scheduled runs are aborted with the reason dag schedule suspended before dispatch.
  • Catch-up windows are consumed. Slots inside the pause are not replayed after it. A two-hour pause with catchup_window: "6h" loses those two hours.
  • Automatic retries are lost for failed runs that age out of scheduler.retry_failure_window (24 hours by default) during the pause.

To keep missed runs for most DAGs, suspend the specific DAGs instead. After a resume, scheduling picks up from the next tick. While paused, NEXT_RUN in dagu ls reads -.

Wake Hold ​

After the host wakes from sleep, the scheduler's first tick fires the slot of that minute and every one-off schedule whose time has passed. scheduler.wake_hold makes it wait first, so the DAG definitions can be refreshed:

yaml
# config.yaml
scheduler:
  wake_hold: "5m"   # default "0": never hold

When a tick comes more than a minute late, the scheduler pauses itself, with scheduler as the actor. The hold ends when the pause is cleared or wake_hold passes, and the held ticks then run in order. Unlike an operator's pause, a wake hold aborts no queued run, keeps retries going, and consumes no catch-up window. DAGU_SCHEDULER_WAKE_HOLD sets the same value; see the configuration reference.

Dagu is open source under the GNU General Public License v3.0.