Infrastructure
Linux: diagnose a systemd timer before replaying a missed job
A production runbook for separating timer schedules, service execution and business outcomes before safely recovering a scheduled job.
A daily export is missing downstream, yet export.timer is active. Starting the service again may duplicate an export that already wrote partial data, reached the destination, or is still running on another host.
This example uses a fictional VM and export. Adapt unit names, permissions and dates. The commands inspect a system service; for a user timer, use its owner’s context and systemctl --user. Identify the service owner and recovery procedure before making changes.
Establish the contract and preserve evidence
Record the host, unit, expected UTC window, configured time zone, deployed version and downstream impact. Identify the export’s business key, expected output and destinations. Check other hosts and schedulers that could run the same work. An active timer proves neither an on-time trigger nor a successful export.
date -u
timedatectl status
systemctl list-timers --all export.timer
systemctl status export.timer export.service --no-pager
systemctl cat export.timer export.service
systemctl show export.timer -p Unit -p ActiveState -p LastTriggerUSec -p NextElapseUSecRealtime
systemctl show export.service -p ActiveState -p SubState -p Result -p ExecMainStatus
journalctl -u export.timer -u export.service --since "2026-11-18 00:00:00 UTC" --until "2026-11-18 08:00:00 UTC" -o short-iso --no-pager Compare timestamps with the expected window and retain the output, journal and job identifier. list-timers describes timer events, not business effects. Journals can be incomplete because of retention, a reboot or a different user context. systemctl cat shows files and drop-ins on disk; if a change has not been reloaded, they may differ from the loaded configuration. Inspect effective properties and deployment history before drawing a conclusion.
Separate the failure modes
| Observation | Hypothesis to test | Next evidence |
|---|---|---|
| No expected event | Disabled timer, calendar, time zone or clock issue | State, loaded schedule, synchronization and recent change |
| Event falls during downtime | Host or manager unavailable | Boot time, OnCalendar= and Persistent= |
| Timer fired while service was active | Previous run exceeded its window or service remained active | Duration, process, service type and downstream state |
| Service failed | Dependency, permissions or command failure | Result, exit status and service journal |
| Service succeeded but export is missing | Technical success differs from business outcome | Batch ID, destination and downstream acknowledgement |
With OnCalendar=, Persistent=true can trigger one catch-up activation when the timer becomes active after at least one missed event; it does not replay every missed occurrence. If the target unit is already active when the timer elapses, systemd does not restart it automatically. A service intended to run periodically may therefore be a poor fit for RemainAfterExit=yes. Consult systemd.timer and check the installed version.
Check AccuracySec= and RandomizedDelaySec= as well: a delay may be intentional. Use systemd-analyze calendar on the host to inspect a calendar expression, and check the effective time zone and clock synchronization. Local scheduling delays and version differences still matter.
Choose a bounded recovery
Before starting anything, reconcile the expected batch key against application logs, generated files or messages and the recipient’s acknowledgement. Missing logs do not prove that no side effect occurred. If the outcome is unknown or another run may still execute, hold recovery and involve the owner. Do not remove a timer timestamp or lock merely to force a catch-up without understanding its purpose.
If the batch is demonstrably absent and the application supports a time range and idempotency key, prepare an approved, monitored manual run limited to that batch. Ensure the next scheduled event cannot race it: local procedures may call for temporarily stopping the timer. Stopping a timer does not stop an already running service. If recovery cannot be bounded or deduplicated, use the business recovery procedure or escalate; do not assume systemctl start is safe.
Validate and retain a rollback
After the targeted configuration fix or replay, compare the expected batch with the received result, acknowledgement, logs and number of effects. Confirm one output for the key, no concurrent execution and the next scheduled event. Observe at least one normal cycle, with an alert on the business outcome as well as service health.
If the timer change fails, restore the known unit and drop-ins, reload configuration under the local procedure, and check the state and next event again. Configuration rollback does not retract an export already delivered: use the recipient’s compensation procedure and preserve evidence. Keep the timer suspended if automatic recovery is still unsafe, and record who owns re-enablement.