Use it instead of cron for jobs that need logging, dependencies or resource limits, or when a timer did not fire.
systemd Timers
systemd timers schedule a .service with OnCalendar= (calendar times) or monotonic delays (OnBootSec=, OnUnitActiveSec=). They log to the journal and can catch up missed runs with Persistent=true.
1. systemctl list-timers --all | grep <name> — next and last run.
2. Timer enabled? systemctl enable --now <name>.timer.
3. systemd-analyze calendar '<expr>' — correct schedule?
4. journalctl -u <name>.service — result.
5. systemctl start <name>.service to test by hand.
timer active → OnCalendar reached (or missed run with Persistent) → service started → result logged
For Scheduling → systemd Timers, continue with the first unproven Topic check: Resolve timer→service mapping, unit files/drop-ins, enablement and current active state; read next/last trigger and the normalized calendar expression. If that boundary is healthy, advance to the adjacent check: Identify clock basis, Persistent=, AccuracySec=, RandomizedDelaySec= and dependencies that can delay, coalesce or catch up execution. Preserve the same host/time/identity scope and rerun the original workload before accepting recovery.
Continue only after interpreting the current observation.Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
journalctl -u backup.serviceVerification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Operational evidence path Verify boundary
timer unit/drop-ins → daemon load + enablement → clock/calendar/monotonic eligibility → timer trigger → service job → process/result → target read-back → workload acceptance
Healthy evidence: effective timer config, enablement and next trigger match intent; the correlated service invocation succeeds and target read-back confirms the intended result.
Step 2 Verification and output interpretation Verify boundary
Existing fast checks for this Topic. - Resolve timer→service mapping, unit files/drop-ins, enablement and current active state; read next/last trigger and the normalized calendar expression.
- Identify clock basis, Persistent=, AccuracySec=, RandomizedDelaySec= and dependencies that can delay, coalesce or catch up execution.
- Correlate timer activation with the service unit's invocation ID, journal, effective user/environment, exit/result and any restart/overlap behavior.
- After a minimal fix, daemon-reload only when required, read back timer/service state, reproduce the activation and verify the original target effect.
Verification chain. timer unit/drop-ins → daemon load + enablement → clock/calendar/monotonic eligibility → timer trigger → service job → process/result → target read-back → workload acceptance
Step 3 Commands Verify boundary
systemctl list-timers --all
systemctl cat backup.timer
journalctl -u backup.service
Step 4 Failure modes and next checks Narrow the fault
Suspicious evidence: timer is enabled but inactive, next trigger is unexpected due timezone/randomization, Persistent catch-up surprises operators, service mapping is wrong, or timer success hides service/workload failure.
Step 5 Common mistakes Narrow the fault
- Enabling the service instead of the timer.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
Create a .service and a .timer with the same name, enable the timer. Add RandomizedDelaySec= to avoid many hosts running at once. Check expressions with systemd-analyze calendar.
systemd-analyze calendar '<expr>'— normalised schedule and next timesystemctl list-timers --all— systemd timers and next runcrontab -l -u <user>— a user's cron jobsls /etc/cron.d /etc/cron.daily— system cron jobsjournalctl -u cron -u crond --since today— cron executions
ReferenceWhat it is1 section · depth on demand
Core model
Resolve the timer unit and the service it activates, then distinguish unit-file definition from enabled/active runtime state. Inspect next/last trigger using the timer's clock basis, persistence and randomized delay, correlate timer activation with the service job/result, and finally verify the service's target effect.
ReferenceImportant terms & boundaries5 sections · depth on demand
What this shows and what it does not
A systemd timer is verified only when its effective unit definition and next/last trigger are correct, the intended service activation is correlated to the trigger, and the service's original workload effect is verified.
In depth
Moving cron jobs to systemd timers
Converting a cron job to a systemd timer gives it logging, resource limits and catch-up after downtime. The systemd.timer(5) manual page describes the parts that matter:
- The timer starts a unit with the same name by default (
Unit=can name another). OnCalendar=holds the schedule.Persistent=trueruns missedOnCalendar=jobs after boot.RandomizedDelaySec=spreads jobs over time.AccuracySec=(default one minute) lets systemd group wake-ups.WakeSystem=can resume a suspended machine.
Translating schedules
| cron | OnCalendar= |
|---|---|
15 2 * * * | *-*-* 02:15:00 |
*/10 * * * * | *:0/10 |
0 8-17 * * 1-5 | Mon..Fri 08..17:00 |
0 0 1 * * | monthly (or *-*-01 00:00:00) |
@reboot | OnBootSec=1min (monotonic) |
Conversion in four steps
| Step | Content |
|---|---|
1. Service unit (Type=oneshot) | ExecStart= with the command; User=; limits |
| 2. Timer unit | OnCalendar=, Persistent=true, [Install] WantedBy=timers.target |
| 3. Enable and start the timer | systemctl enable --now job.timer |
| 4. Remove the cron line | Avoid running it twice |
Transient timers without unit files
systemd-run --on-calendar=... or --on-active=... creates a temporary timer and service in one command. That's convenient for one-off delayed tasks.
host$ sudo tee /etc/systemd/system/report-cleanup.service >/dev/null <<'EOF'
[Unit]
Description=Delete old report exports
[Service]
Type=oneshot
User=reportapi
ExecStart=/usr/local/bin/report-cleanup --days 30
Nice=10
IOSchedulingClass=idle
EOF
host$ sudo tee /etc/systemd/system/report-cleanup.timer >/dev/null <<'EOF'
[Unit]
Description=Daily report cleanup
[Timer]
OnCalendar=*-*-* 04:00:00
Persistent=true
RandomizedDelaySec=15min
[Install]
WantedBy=timers.target
EOF
host$ sudo systemctl daemon-reload && sudo systemctl enable --now report-cleanup.timer
host$ sudo rm /etc/cron.d/report-cleanup
host$ sudo systemctl start report-cleanup.service && journalctl -u report-cleanup -n 5
host$ sudo systemd-run --on-active=30min --unit=one-off-reindex /usr/local/bin/reindex
host$ systemctl list-timers 'report-*' 'one-off-*'
Test the service directly
Starting the .service by hand runs the job immediately, with exactly the environment the timer will use. Do this before waiting for the schedule. Nice= and IOSchedulingClass=idle keep the cleanup from competing with the application.
Documented example, not captured output.
How it works at runtime
systemd Timers is part of Scheduling → systemd Timers. systemd timers schedule service-unit activation using calendar (OnCalendar) or monotonic timers (OnBootSec, OnUnitActiveSec, etc.), with explicit enablement, persistence, accuracy/randomization and unit dependency semantics.
Topic-specific state model. systemd timers schedule service-unit activation using calendar (OnCalendar) or monotonic timers (OnBootSec, OnUnitActiveSec, etc.), with explicit enablement, persistence, accuracy/randomization and unit dependency semantics.
Interpretation rule. - Timer unit enabled ≠ it is currently active or has a valid next trigger.
- Timer fired ≠ the activated service succeeded; timer and service have separate unit results.
- Service exited successfully ≠ the intended workload state was achieved.
- Calendar timer ≠ monotonic timer; wall-clock/timezone changes and elapsed-interval semantics affect different timer types differently.
Quick reference
Converting a cron job to a systemd timer:
# /etc/systemd/system/cleanup.service
[Unit]
Description=App cleanup
[Service]
Type=oneshot
User=app
ExecStart=/opt/app/bin/cleanup --days 30
Nice=10
IOSchedulingClass=idle
# /etc/systemd/system/cleanup.timer
[Timer]
OnCalendar=*-*-* 03:00
Persistent=true
RandomizedDelaySec=10m
[Install]
WantedBy=timers.target
systemctl daemon-reload && systemctl enable --now cleanup.timer
systemctl start cleanup.service # run now for testing
journalctl -u cleanup.service -n 50
Add OnFailure=notify@%n.service to the service for alerting.
Limits and how it fails
Primary failure point. A systemd timer is verified only when its effective unit definition and next/last trigger are correct, the intended service activation is correlated to the trigger, and the service's original workload effect is verified.
ReferenceConfiguration & state1 section · depth on demand
Configuration, persistence and lifecycle
Distribution/platform context. systemd Timers owns systemd timer activation semantics. systemd & Services owns generic unit/service lifecycle; Time & NTP owns wall-clock basis; the target service/application owns workload correctness.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Scheduling → systemd Timers. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://www.freedesktop.org/software/systemd/man/latest/systemd.timer.html · confidence 94%What changed and what may be affected
Recent technical edits are separated from ordinary page timestamps. Relationship impact is advisory: it identifies nearby canonical references to review, not automatic breakage.
Terms & aliases
Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.
Quick lookup tables
systemd Timers operational reference
Topic-specific lookup boundaries, proof limits and next-step Evidence for systemd Timers.
| Lookup boundary | Topic-specific reference | Operational use |
|---|---|---|
| Scope / effective state | systemd timers schedule service-unit activation using calendar (OnCalendar) or monotonic timers (OnBootSec, OnUnitActiveSec, etc.), with explicit enablement, persistence, accuracy/randomization and unit dependency semantics. | Establish exactly what this Topic owns before crossing into another subsystem. |
| Fast verification | Pin exact symptom + clock/trigger time → identify authoritative scheduler or time daemon → read back effective configuration/runtime state → reproduce or observe the expected event/source measurement → correlate identity/environment/offset/status with logs → change one demonstrated cause → read back stable state → repeat original scheduled or time-sensitive workload + regression check. | Use the shortest evidence path first; a fast check is a boundary test, not blanket proof. |
| Verification chain | timer unit/drop-ins → daemon load + enablement → clock/calendar/monotonic eligibility → timer trigger → service job → process/result → target read-back → workload acceptance | Trace requested/configured state through effective state to the observed workload result. |
| Failure boundary | A systemd timer is verified only when its effective unit definition and next/last trigger are correct, the intended service activation is correlated to the trigger, and the service's original workload effect is verified. | Stop broad troubleshooting at the first boundary that is not supported by evidence. |
| Positive evidence | Correlated Linux scheduling/time evidence can establish this proof path: timer unit/drop-ins → daemon load + enablement → clock/calendar/monotonic eligibility → timer trigger → service job → process/result → target read-back → workload acceptance | Use this observation only for the specific claim it actually supports. |
| Evidence limit | It does not independently prove behavior outside the captured host, clock/timezone, scheduler or time-daemon instance, identity/environment, source, trigger/measurement interval or workload scope. A systemd timer is verified only when its effective unit definition and next/last trigger are correct, the intended service activation is correlated to the trigger, and the service's original workload effect is verified. | Do not promote a local success signal into end-to-end or adjacent-dependency proof. |
| Next troubleshooting check | Continue from the first unproven scheduling/time boundary: preserve the original timing and execution/source context, capture the adjacent scheduler/process or clock/source state, change only the demonstrated cause, then repeat the original scheduled or time-sensitive workload and regression checks. | Continue to the next unresolved boundary while preserving the original test condition. |
systemd Timers · operational reference
Compact Linux state, persistence, verification and boundary reference for fast lookup.
| Reference boundary | systemd Timers |
|---|---|
| Topic path | Scheduling → systemd Timers |
| Runtime state | systemd timers schedule service-unit activation using calendar (OnCalendar) or monotonic timers (OnBootSec, OnUnitActiveSec, etc.), with explicit enablement, persistence, accuracy/randomization and unit dependency semantics. |
| Fast checks | - Resolve timer→service mapping, unit files/drop-ins, enablement and current active state; read next/last trigger and the normalized calendar expression. - Identify clock basis, Persistent=, AccuracySec=, RandomizedDelaySec= and dependencies that can delay, coalesce or catch up execution. - Correlate timer activation with the service unit's invocation ID, journal, effective user/environment, exit/result and any restart/overlap behavior. - After a minimal fix, daemon-reload only when required, read back timer/service state, reproduce the activation and verify the original target effect. |
| Verification chain | timer unit/drop-ins → daemon load + enablement → clock/calendar/monotonic eligibility → timer trigger → service job → process/result → target read-back → workload acceptance Boundary chain: local authoritative state → adjacent dependency → effective/programmed state → original workload/request → return/regression → explicit Evidence boundary. Boundary chain: local authoritative state → adjacent dependency → effective/programmed state → original workload/request → return path or regression → explicit Evidence boundary. |
| Failure boundary | A systemd timer is verified only when its effective unit definition and next/last trigger are correct, the intended service activation is correlated to the trigger, and the service's original workload effect is verified. |
| Persistence rule | Prove which configuration source owns the state, then prove that the running consumer loaded or generated the intended state. |