Pcornel
Browse topics
Options
Recent
Favorites
Automation · Technical reference

systemd Timers · Bash Automation

Direct answer

systemd timers schedule services with .timer units using OnCalendar= or OnBootSec=, with logging in journald, Persistent=true for missed runs and dependencies, as a modern alternative to cron.

When to use this

Use this when scheduling with systemd timers.

First 30 seconds

1. systemd timers trigger service units.

2. OnCalendar, Persistent=true for missed runs.

3. Logging in journal.

4. Dependencies and sandboxing.

5. RandomizedDelaySec to spread load.

Operational verification

timer → service unit → journal

Context & applicabilityCommon mistakes · platform/version boundaries
Platform / version applicability
GNU Bash shell automation
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

PlatformGNU Bash shell automation · Automation implementations are tool and platform specific. Use the adjacent Domain for the technology being automated and this Domain for automation behavior.
Scope / prerequisiteUse this when scheduling with systemd timers.
What next?3 suggested next steps
Evidence1
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

2 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

Capture the concrete output, symptom, packet, log or counter before changing anything.

Step 1 Verification path Verify boundary

The negative fixture should deliberately exercise risks such as unquoted expansion, globbing, pipeline status loss, subshell scope, set -e misconceptions, signal races, temporary-file leakage and destructive path ambiguity, choosing the cases most relevant to OnCalendar/monotonic timers, Persistent, RandomizedDelaySec, accuracy, associated service unit and journal/state proving actual dispatch.

Step 2 Common mistakes Narrow the fault
  • Forgetting the matching .service unit.
  • Not enabling the timer.
Evidence references

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.

observation · 1
Key points
  • Pair .timer with .service.
  • OnCalendar= for schedules.
  • Persistent=true catches missed runs.
Key checks
  • systemctl list-timers --all — timers
  • systemctl status <name>.timer <name>.service — state
  • journalctl -u <name>.service — run logs
ReferenceWhy it matters1 section · depth on demand

What it is

systemd timers are the modern alternative to cron: a .timer unit triggers a .service unit, with logging in the journal, missed-run catch-up (Persistent=true) and randomised delays.

ReferenceImportant terms & boundaries2 sections · depth on demand

Example

# backup.timer
[Timer]
OnCalendar=*-*-* 02:00
Persistent=true
[Install]
WantedBy=timers.target

systemctl enable --now backup.timer, systemctl list-timers, journalctl -u backup.service.

In depth

systemd timers are the modern way to schedule Bash scripts on Linux. Compared with cron they give journal logging, missed-run catch-up, randomised delays, dependency ordering and resource limits — and systemctl list-timers shows when each job last and next runs.

# disk-report.timer
[Timer]
OnCalendar=hourly
RandomizedDelaySec=5m
Persistent=true
[Install]
WantedBy=timers.target
# disk-report.service
[Service]
Type=oneshot
ExecStart=/usr/local/bin/disk-report.sh
systemctl enable --now disk-report.timer
systemctl list-timers --all | grep disk-report
systemctl start disk-report.service          # run now for testing

The script's exit code becomes the unit's result, so failures are visible in systemctl --failed and can trigger OnFailure= notifications.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor docGNU Bash shell automation current

Authoritative/upstream documentation reviewed for bounded claims in Bash Automation > systemd Timers. Documentation verification only; this is not observed lab or production Evidence.

Basis: https://www.gnu.org/software/bash/manual/bash.html · confidence 94%
Depth when you need it

Deep reference

Healthy vs suspicious evidence

Output interpretation

For OnCalendar/monotonic timers, Persistent, RandomizedDelaySec, accuracy, associated service unit and journal/state proving actual dispatch, prefer typed fields and stable IDs over human presentation text.

Confirmation

Confirm action

Continue?