Catch-up and the Window
Every Run is told which span of time it's responsible for: its Window, which the rest of this site calls the run window. After the Mac slept, or a Run failed, the Window widens to cover everything not yet covered. Write your Script against the Window and catch-up takes care of itself.
The Window
A Run's Window runs from the last Slot covered by a successful Run, up to the Run's own Slot. It's open at the start and closed at the end: (start, end]. The start was already covered; the end is this Run's to cover.
Normally the Window is one Schedule period. For an hourly Job, the 10:00 Run covers (9:00, 10:00]. A Job's very first Run also gets one period.
Missed Slots and Catch-up Runs
A Missed Slot is a Slot that passed without a Run covering it, because:
- the Mac was asleep or off;
- Crontastic wasn't running;
- the Job was still busy with an earlier Run;
- the Run for that Slot didn't succeed.
Slots while a Job is Paused or Pending Approval are never Missed Slots. A Run whose Window covers one or more Missed Slots is a Catch-up Run.
Example An hourly Job last succeeded at midnight, and the Mac slept from 12:47 AM to 7:12 AM. Shortly after the Mac wakes, Crontastic starts one Catch-up Run for the 7:00 Slot. Its Window is 12:00 AM to 7:00 AM, and CRONTASTIC_MISSED_COUNT is 7.
Catch-up Runs wait 30 seconds after Crontastic opens or the Mac wakes, to give the network and disks time to come back. You can change the wait in Settings.
Only Succeeded moves the Window
The exit code is the Outcome. Exit 0 is Succeeded, and moves the Window's start up to the Run's Slot. Anything else leaves the start where it was, so the next Run covers that time again. Nothing is lost when a Run fails; it's owed.
| Outcome | Moves the Window |
|---|---|
| Succeeded | Yes |
| Failed, Timed out | No, unless the Job sets advance_on_success_only = false |
| Cancelled, Interrupted | Never |
A failed Run isn't retried in a loop. Crontastic waits for the Job's next Slot, and that Run's Window includes the failed span. Its CRONTASTIC_MISSED_COUNT counts the failed Slots too.
This is why a Script must never exit 0 after an error. If it does, the Window moves on and that span is never covered again. For multi-line commands, keep Stop at the first failing line on (stop_on_error = true).
Catch-up Policies
Each Job's Catch-up Policy decides what happens to its Missed Slots. Set it in the Job editor or with catch_up in the Job file.
Once (default)
catch_up = "once". One Catch-up Run covers the whole Window, however wide. Pick it for Scripts that work on a range: pulling data since a time, syncing changes, processing new files. It's the cheapest and the most common.
Replay each
catch_up = "replay_each". One Run per Missed Slot, in order, each with a Window of one Schedule period. Replay stops at the first Run that doesn't succeed; the remaining Slots stay in the Window for the next Run. Pick it when every Slot needs its own Run, such as a daily report for each day:
# the date of the Slot, e.g. 2026-11-22
day="${CRONTASTIC_SCHEDULED_AT%%T*}"
~/bin/daily-report --date "$day"
Replay each starts at most 48 Runs for one catch-up. With more Missed Slots than that, Crontastic falls back to one Run covering the whole Window. Change the limit with replay_cap.
Skip
catch_up = "skip". Missed Slots are dropped: the Window moves forward without running. If the latest Slot is on time, it runs normally for that Slot alone. Pick it when only the present matters: heartbeats, cleanups, “is the server up” checks, or a reminder that's pointless after the fact.
The Run Context
Every Run gets these environment variables. Dates are ISO 8601 to the second, with a numeric offset in the Job's time zone (for example 2026-11-22T07:00:00-08:00). The _EPOCH variants are Unix seconds.
| Variable | Meaning |
|---|---|
CRONTASTIC_SCHEDULED_AT | The Slot this Run stands for |
CRONTASTIC_WINDOW_START | Start of the Window, not included |
CRONTASTIC_WINDOW_END | End of the Window, included |
…_EPOCH variants | The same three, as Unix seconds |
CRONTASTIC_MISSED_COUNT | Slots in the Window that weren't run on time |
CRONTASTIC_IS_CATCHUP | 1 for a Catch-up Run, else 0 |
CRONTASTIC_TRIGGER | scheduled, catchup, manual or test |
CRONTASTIC_JOB_ID, CRONTASTIC_RUN_ID | Identifiers |
The same values can go straight into the command text as placeholders, filled in before the command runs:
| Placeholder | Same as |
|---|---|
{{slot}}, {{slot_epoch}} | CRONTASTIC_SCHEDULED_AT… |
{{window_start}}, {{window_start_epoch}} | CRONTASTIC_WINDOW_START… |
{{window_end}}, {{window_end_epoch}} | CRONTASTIC_WINDOW_END… |
{{missed_count}} | CRONTASTIC_MISSED_COUNT |
{{is_catchup}} | CRONTASTIC_IS_CATCHUP |
{{trigger}} | CRONTASTIC_TRIGGER |
{{job_id}}, {{run_id}} | CRONTASTIC_JOB_ID, CRONTASTIC_RUN_ID |
Placeholders are inserted without quotes; the values never contain spaces or shell metacharacters. Names are case-sensitive, and unknown placeholders are left as they are; the Job editor highlights the ones it knows. The CRONTASTIC_* variables always win over variables of the same name from env files or env.
Writing window-aware Scripts
Crontastic only knows the command. Interpreting the Window is the Script's job. Two rules cover most of it:
- Cover the Window, not “the last hour”. Fetch or process everything after
CRONTASTIC_WINDOW_STARTup to and includingCRONTASTIC_WINDOW_END. A Catch-up Run's Window can span hours or days; a fixed lookback silently drops the rest. - Make reruns safe. A failed Run's Window is covered again by the next Run, so the same data can arrive twice. Overwrite, upsert or dedupe; don't append blindly.
This Script saves every order in its Window to one file named after the Window's end. A rerun replaces files instead of adding to them, and any failed step fails the Run, so the Window stays open for the next one.
#!/bin/bash
# ~/bin/pull-orders (example)
set -euo pipefail
start="$CRONTASTIC_WINDOW_START" # excluded
end="$CRONTASTIC_WINDOW_END" # included
out="$HOME/data/orders"
mkdir -p "$out"
echo "Window $start to $end"
echo "Missed Slots: $CRONTASTIC_MISSED_COUNT"
tmp="$(mktemp)"
curl -fsS -G "https://api.example.com/orders" \
--data-urlencode "after=$start" \
--data-urlencode "until=$end" \
-o "$tmp"
# Move into place only when the download worked.
mv "$tmp" "$out/$CRONTASTIC_WINDOW_END_EPOCH.json"
And the Job that runs it:
name = "Pull orders"
cron = "0 * * * *"
catch_up = "once"
timeout = "10m"
command = "~/bin/pull-orders"
If you load the files into a database, upsert by order ID, since a wider Window after a failure overlaps what an earlier Run may already have saved.
Use the Job editor's Test Run, or Run Now, to check what the Script does with a Window before relying on the Schedule.
While the Mac sleeps
Crontastic can't run anything while the Mac is asleep or off. It catches up afterwards.
- No scheduled Run starts while the Mac is asleep, including the brief maintenance wakes of Power Nap. Those Slots are caught up after the next full wake.
- While a Run is in progress, Crontastic keeps the Mac from going to sleep when idle. Closing the lid or choosing Sleep still puts it to sleep.
- If the Mac sleeps during a Run, the Run records how long it slept. If that Run then doesn't succeed, its Outcome is Interrupted, not Failed: the Script was frozen, not broken. No failure notification is sent, and the Window stays open for the next Run.
- If Crontastic quits during a Run, that Run is recorded as Interrupted when it next opens.
Manual and Test Runs
A Manual Run (Run Now in the app, or run_job_now over MCP) runs the Job on demand, outside its Schedule. It appears in history but never moves the Window.
A Test Run, from the Job editor or test_run over MCP, really executes the command, but isn't counted in history and doesn't move the Window.
Both get a Run Context. Their Slot is the moment they started, their Window runs from the last covered Slot to that moment, and CRONTASTIC_MISSED_COUNT is 0. Check CRONTASTIC_TRIGGER if a Script should behave differently when you run it by hand.