Stop cron from missing jobs after a power failure
Cron & Task Scheduling (Cron/Systemd Timers/At)
Stop cron from missing jobs after a power failure
🧩 The Challenge
Everyone has had that moment where the server goes down for maintenance or a quick reboot, and your midnight backup script just never runs. Cron is “fire and forget,” but it isn’t “catch up when you get back.”
💡 The Fix
Switch that old cron entry over to a systemd timer with persistent behavior, which tells the system to run the missed task as soon as it boots back up.
systemctl edit --full my-task.timer
[Unit]
Description=Run backup daily
[Timer]
OnCalendar=daily
Persistent=true
[Install]
WantedBy=timers.target
⚙️ Why It Works
Setting Persistent to true forces the service manager to check if the last scheduled trigger time was missed while the system was offline. If it finds a gap, it queues the task immediately upon reaching the multi-user target.
🚀 Pro-Tip: Use systemd-analyze calendar ‘daily’ to preview exactly when your timer is going to fire next.
Linux Tips & Tricks | © ngelinux.com | 11/6/2026
