← all posts

Missed cron jobs after shutdown or suspend: anacron vs systemd Persistent= vs catch-up

What cron, anacron, systemd timers and RunWisp do with a run that was due while the machine was off or asleep, including cron's 3-hour rule and anacron's AC-power check, plus a test you can run in five minutes.

10 min read

Your backup is 0 3 * * *. The box was off at 03:00, or the laptop lid was closed. In the morning there’s no new archive, no error, and nothing in the log, because from cron’s point of view nothing happened.

Whether a missed run comes back depends on the scheduler, and on whether the machine was off or asleep. Those are different cases, and each tool handles them differently.

Short answer

Plain cron never re-runs a job that was due while the machine was off. anacron catches up daily, weekly and monthly jobs once, the next time it runs, but works in whole days, and on Debian, Ubuntu and Fedora it skips on battery power. A systemd timer with Persistent=true fires once at boot if an OnCalendar= time passed while it was off, and any calendar timer fires once on resume after suspend. RunWisp, an open-source cron replacement that ships as a single binary, re-runs the latest missed tick by default (catch_up), records the gap as a missed run and alerts on it. None of them runs the job while the machine is actually off. To wake a suspended machine for a job, you need systemd’s WakeSystem= or rtcwake.

What each scheduler does with a missed run

Scheduler Machine was off Machine was asleep Several runs missed Records the miss
cron Skipped Under 3 h: fixed-time jobs run on waking. Over 3 h: skipped Each fixed-time run, if under 3 h No
anacron Runs once, next time anacron starts Same as off Once No
systemd OnCalendar= Skipped Runs once on waking Once No
…plus Persistent=true Runs once at boot Runs once on waking Once No
systemd OnUnitActiveSec= Counts again from boot Late by the time asleep n/a No
RunWisp Runs the latest one (default) Runs once on waking Up to catch_up Yes, and alerts

The “asleep” column assumes the scheduler process was frozen along with everything else, which is what suspend and hibernate do. A VM snapshot restore behaves the same way.

cron: skipped when off, the 3-hour rule when asleep

cron only knows “now”. It wakes once a minute, compares the time with every crontab line and runs what matches. When the machine is off, there’s no process to notice that 03:00 came and went, and when it boots, cron starts at the current minute.

Suspend is more interesting, because cron is still running when the machine wakes, and it notices the clock has jumped. Both cronie and Debian’s cron handle that with the logic written for daylight saving time. The cronie man page puts it like this:

If time was adjusted one hour forward, those jobs that would have run in the interval that has been skipped will be run immediately. […] Time changes of more than 3 hours are considered to be corrections to the clock or the timezone, and the new time is used immediately.

In cronie’s cron.c that’s four cases, keyed on how far the clock moved since the last check:

  • Up to 5 minutes forward: every job for every skipped minute runs, wildcards included. That’s a late wake-up, not a time change.
  • 5 minutes to 3 hours forward: jobs with a fixed minute and hour (0 3 * * *) that fell in the gap run once each. Jobs with * in the minute or hour field (*/15 * * * *, @hourly) just carry on from the current minute.
  • More than 3 hours forward: treated as a clock correction. Nothing from the gap runs.
  • Backward: fixed-time jobs aren’t run a second time.

So a laptop that sleeps from 02:00 to 04:30 runs the 03:00 backup when it wakes. One that sleeps from midnight to 08:00 doesn’t, and nothing records that it was skipped. That’s why the daily, weekly and monthly lines in Debian and Ubuntu’s /etc/crontab start with test -x /usr/sbin/anacron ||: when anacron is installed, cron hands those jobs to it.

anacron: once per day, if you’re plugged in

anacron doesn’t keep a schedule in hours and minutes. Each job in /etc/anacrontab has a period in days, a delay in minutes and a name:

# period  delay  job-id        command
1         5      cron.daily    run-parts --report /etc/cron.daily
7         10     cron.weekly   run-parts --report /etc/cron.weekly
@monthly  15     cron.monthly  run-parts --report /etc/cron.monthly

When it runs, it reads a date stamp per job from /var/spool/anacron/. If at least period days have passed, it waits delay minutes, runs the job and writes today’s date. Then it exits. It only compares dates, not times: a daily job last run at 23:50 is due again just after midnight. It runs a missed job once, however many periods were missed.

Something has to start anacron, and that’s where the conditions come in:

  • Debian and Ubuntu: anacron.timer fires at OnCalendar=*-*-* 07..23:30 with Persistent=true, and anacron.service has ConditionACPower=true. Nothing runs between 23:30 and 07:30, or on battery. The unit file itself says to clear the condition with a drop-in if you want it on battery.
  • Fedora, RHEL and other cronie systems: cron runs /etc/cron.hourly/0anacron, which exits on battery unless ANACRON_RUN_ON_BATTERY_POWER=yes is set in /etc/default/anacron. The stock anacrontab sets START_HOURS_RANGE=3-22 and RANDOM_DELAY=45.

One more thing we hit while testing: anacron stamps the job as done even when it fails. We ran a job that ran exit 1 with a two-day-old stamp. anacron logged exit status: 1, tried to mail the output, found no sendmail, and wrote today’s date. It won’t try again until tomorrow.

You can run anacron as an ordinary user against your own table and spool directory, which makes it easy to test:

mkdir -p ~/anacron-test/spool && cd ~/anacron-test
printf '1\t0\treport.daily\techo "ran $(date +%%F)" >> %s/out.log\n' "$PWD" > anacrontab
date -d '3 days ago' +%Y%m%d > spool/report.daily   # pretend it last ran 3 days ago
anacron -d -n -t anacrontab -S spool                 # runs it once
anacron -d -n -t anacrontab -S spool                 # "0 jobs run"

On Ubuntu 26.04 with anacron 2.3, the first call ran the job once and set the stamp to today; the second ran nothing.

systemd timers: Persistent= for shutdowns, resume is automatic

systemd treats the two cases separately, and the systemd.timer man page covers both.

Suspend needs no setting. The realtime clock keeps running during sleep, and for OnCalendar= timers systemd says that “once the system is later resumed it will catch up and process all timers that triggered while the system was sleeping”. If the time passed several times during one sleep, the service still starts once.

Shutdown needs Persistent=true. With it, systemd writes the last trigger time to a stamp file (/var/lib/systemd/timers/stamp-NAME.timer, or ~/.local/share/systemd/timers/ for user timers). When the timer starts again at boot, it starts the service once if a calendar time was missed:

# /etc/systemd/system/backup.timer
[Timer]
OnCalendar=*-*-* 03:00:00
Persistent=true
# optional: spread boot-time catch-ups over 10 minutes
RandomizedDelaySec=10m

[Install]
WantedBy=timers.target

Persistent= only works with OnCalendar=. Timers built on OnUnitActiveSec= or OnBootSec= use a monotonic clock that pauses during suspend, so “every 6 hours” means six hours of being awake, and they start counting again from boot. If you need the machine to wake up for the job, WakeSystem=true does that for a system timer, on hardware that supports RTC wake-up. It won’t put the machine back to sleep afterwards.

To check what systemd thinks, look at the LAST and NEXT columns:

systemctl list-timers --all backup.timer
journalctl -u backup.service --since today

A five-minute test you can run

Here’s a user timer pair that fires every minute, one with Persistent=true and one without. Start both, stop them across two minute boundaries to simulate the machine being off, then start them again:

mkdir -p ~/.config/systemd/user && cd ~/.config/systemd/user
for p in p n; do
cat > missed-$p.service <<EOF
[Service]
Type=oneshot
ExecStart=/bin/sh -c 'echo "\$(date +%%T) $p" >> /tmp/missed.log'
EOF
printf '[Timer]\nOnCalendar=*:*:00\nAccuracySec=1s\n' > missed-$p.timer
done
echo 'Persistent=true' >> missed-p.timer
systemctl --user daemon-reload
systemctl --user start missed-p.timer missed-n.timer   # wait for one :00
systemctl --user stop  missed-p.timer missed-n.timer   # "power off" for 2+ minutes
systemctl --user start missed-p.timer missed-n.timer
cat /tmp/missed.log

Our run on systemd 259:

21:06:00 n
21:06:00 p
21:07:00 n
21:07:00 p
== 21:07:39 stopping
== 21:11:02 starting
21:11:02 p

The persistent timer fired the second it was started, once for four missed minutes. The other one waited for the next :00. Clean up with systemctl --user stop missed-p.timer missed-n.timer and delete the four files.

RunWisp: catch_up, and a record of what was missed

RunWisp keeps cron expressions but stores every run, so when the daemon starts it can see which ticks it should have fired since the task’s last recorded run. The catch_up key decides how many of them run:

[tasks.nightly-backup]
run      = "/usr/local/bin/backup.sh"
cron     = "0 3 * * *"
catch_up = 1           # default: run the most recent missed tick

[tasks.metrics-rollup]
run        = "/usr/local/bin/rollup"
cron       = "*/15 * * * *"
catch_up   = 8          # run up to 8 missed ticks, oldest dropped first
on_overlap = "queue"    # required for anything above 1

[tasks.uptime-probe]
run      = "/usr/local/bin/probe.sh"
cron     = "* * * * *"
catch_up = 0           # stale probes are useless; record the gap, don't replay

Whatever catch_up is set to, the gap shows up in the run history as a run with end_reason = "missed", and RunWisp sends a failure alert with the task name and how many runs it missed. The alert goes to the bell in the web UI and to whatever notifiers get that task’s failures. If a task is expected to miss runs, like a daytime sync on a laptop that’s off at night, failures = ["-missed"] keeps the record but drops the alert.

We checked this with RunWisp 1.9.2 and three * * * * * tasks set to catch_up 1, 0 and 3. We stopped the daemon at 21:13:46 and started it at 21:17:06, so four ticks were missed. On start it logged missed=4 catch_up=1 triggering=1 dropped=3 for the first task. The task with catch_up = 3 ran three runs back to back, and the one with catch_up = 0 ran none. Each task got one missed row, and the bell showed:

tick missed
4 scheduled runs missed since 2026-11-10 21:14 (daemon was down);
re-ran the most recent 1, older ticks dropped per catch_up

Suspend is handled separately. Since 1.8.0, the scheduler notices a wall-clock jump within 5 seconds of waking and plans from the new time. A tick the jump skipped runs once, late, and the ticks in between are neither replayed nor counted as missed. A short nap doesn’t page you, and a restart that lost a night’s runs does.

The limits: it catches up only from the daemon’s own history, so a brand-new install doesn’t replay anything from before it first saw a task. Catch-up happens when the daemon starts, not on runwisp reload. It can’t wake a sleeping machine either. If your box sleeps through 03:00 and you need the job at 03:00, that’s WakeSystem= or a machine that stays on. On a box that already uses anacron, include_cron reads /etc/anacrontab and turns cron.daily and friends into tasks with catch_up = 1.

Which one to use

  • A server that’s always on: you mostly care about reboots and maintenance windows. Persistent=true on a systemd timer, or catch_up in RunWisp, covers that. With systemd, a skipped run still looks like nothing happened unless you add failure alerts or a heartbeat.
  • A laptop or desktop: systemd calendar timers already catch up on resume. Add Persistent=true for shutdowns. anacron is fine for daily housekeeping if you can live with the AC-power and 07:30–23:30 conditions.
  • Jobs where every run matters, such as a rollup of each 15-minute slice: neither anacron nor Persistent= replays more than once. RunWisp’s catch_up = N with a queue runs the command up to N times, but each run still has to work out which slice it covers. A job that processes its own backlog from a high-water mark in your database is more robust than any scheduler feature, and then running it once is enough.
  • Jobs where a stale run is harmful, like a probe or an “ends at 09:00” report: turn catch-up off (catch_up = 0, or no Persistent=) and rely on an alert for the gap.

Related: @reboot doesn’t run when a container restarts, the DST post for the same 3-hour rule in spring and autumn, and systemd timer emails on failure. RunWisp’s source is on GitHub.

Common questions

Does cron run missed jobs after the computer was turned off?
No. Vixie cron, Debian's cron and cronie only run jobs whose time matches while the daemon is running. A run that was due while the machine was off is skipped and not logged anywhere. anacron, systemd timers with Persistent=true, or a scheduler with catch-up are the usual ways to get it back.
Does cron run missed jobs after suspend?
Sometimes. On resume, cron sees the clock jump forward. If the jump is under 3 hours, jobs with a fixed minute and hour that fell in the gap run once, right away, and jobs with a * in the minute or hour field don't replay. If the machine slept for more than 3 hours, cron treats it as a clock correction and the skipped runs are lost.
What does Persistent=true do on a systemd timer?
It stores the time the timer last triggered in a stamp file. When the timer is activated again (usually at boot), systemd starts the service once if at least one OnCalendar= time passed while the timer was inactive. It only works with OnCalendar=, and it fires once however many runs were missed.
Why didn't anacron run my daily job on my laptop?
On Debian and Ubuntu, anacron.service has ConditionACPower=true, and Fedora's 0anacron hook checks for mains power too, so on battery nothing runs. On Debian and Ubuntu the timer also only fires between 07:30 and 23:30. anacron also records a job as done for the day even when it exits non-zero.
How does RunWisp handle runs missed while it was down?
RunWisp, an open-source cron replacement that ships as a single binary, checks each cron task for missed ticks when the daemon starts. With the default catch_up = 1 it runs the most recent missed one; catch_up = 0 runs none and a higher number replays up to that many in order (with on_overlap = "queue"). Every gap is recorded as a missed run and, by default, raises a failure alert. After suspend it runs a skipped tick once, late, without counting it as missed. It only catches up what it was scheduled to run; it can't wake a sleeping machine.
  1. Run cron jobs as a non-root user in Docker, without setuid

    USER app doesn't make Debian cron an unprivileged scheduler. Two complete setups with Supercronic or RunWisp, plus the UID, config and writable-volume checks that stop permission errors.

  2. Windows Task Scheduler alternatives for Linux: cron, systemd timers, KCron or a web UI

    Linux has no single Task Scheduler. cron schedules, systemd timers cover most of its Settings tab, KCron gives cron a desktop editor, and a dashboard like RunWisp adds run history. Every Task Scheduler option mapped to its Linux equivalent, with the gaps.

Get started
GPL 3.0 · no accounts · free to self-host

Start in 30 seconds. Ship on your terms.

A single Go binary. If it doesn't earn the disk space, rm it. No account, no signup, no catch.

Install in 30 seconds
curl -fsSL https://get.runwisp.com | sh