Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
World desk5 min

Systemd Explained: Units, Logs and Timers for Recurring Jobs

Systemd uses units to manage services, journalctl to inspect logs, and timer units for many recurring jobs. Learn the basics and see what differs from cron.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Systemd organizes services and other system resources as units, records system activity in a journal you can inspect with journalctl, and can schedule work with timer units. Timers cover many cron-like schedules, but they are not a guaranteed drop-in replacement for every cron feature. This guide explains how the pieces fit together and shows how to create a basic timer, inspect service logs, and check records from an earlier boot.

What is a systemd unit?

A unit is a named object systemd manages for boot-up and system maintenance. Services are one familiar type, but units can represent other resources or actions too. Most units are described by configuration files; some are generated from other configuration or runtime state, or created programmatically. The systemd project’s unit documentation describes the model.

As an Amazon Associate I earn from qualifying purchases.

Units can be active, inactive, activating or deactivating. What “active” means depends on the unit type: a running service and a mounted filesystem are different kinds of active objects.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Requirements and ordering are different

When connecting units, ask two separate questions: must another unit be included, and in what order should their jobs run?

  • Requires= expresses a requirement relationship: a unit depends on another unit being pulled in.
  • After= and Before= express ordering. They specify which job should run first when both units are part of the transaction.

A requirement alone does not make the required unit start first. Without an ordering relationship, requested units can start in parallel. Use the appropriate dependency and ordering directives for the behavior you need.

How do I create a systemd timer?

A systemd timer is a .timer unit that activates a corresponding service unit. For a simple recurring job, create a service describing the work and a timer describing when to run it. The example below runs a script daily; replace the script path with a real executable available on your system.

  1. Create /etc/systemd/system/daily-report.service:

    [Unit]
    Description=Generate daily report
    
    [Service]
    Type=oneshot
    ExecStart=/usr/local/bin/daily-report
  2. Create /etc/systemd/system/daily-report.timer:

    [Unit]
    Description=Run the daily report each day
    
    [Timer]
    OnCalendar=daily
    Persistent=true
    
    [Install]
    WantedBy=timers.target
  3. Tell systemd to reload unit files, then enable and start the timer:

    Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
    sudo systemctl daemon-reload
    sudo systemctl enable --now daily-report.timer
  4. Check that the timer is loaded and see its next scheduled activation:

    systemctl list-timers daily-report.timer

Systemd associates a timer with a service of the same base name by default, so daily-report.timer activates daily-report.service. The service should exit after completing the scheduled task; Type=oneshot is suitable for this kind of job. Check the timer and service manuals installed on your machine for supported syntax and details, since systemd versions can differ.

Calendar time or elapsed time?

Choose a calendar expression such as OnCalendar= when the job belongs at a wall-clock time or on a calendar cadence. Use a monotonic timer directive such as OnBootSec= or OnUnitActiveSec= when the event should occur after boot or after a unit activation, rather than at a particular time of day.

These are different scheduling models, not merely different spellings of a cron line. Calendar timers suit jobs tied to dates and clock times; monotonic timers suit intervals measured from an event or boot.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What does Persistent=true do?

For calendar timers, Persistent=true records when the timer last triggered. If the machine was off when a scheduled event should have occurred, systemd may run the overdue event after the machine returns. This is a possible catch-up run, not a queue that replays every missed interval. Confirm that the directive and its behavior match the systemd version installed on the target machine.

How is a systemd timer different from cron?

Systemd timers handle many calendar-based recurring jobs and connect scheduling to systemd’s unit model. The systemd project’s historical release notes said calendar timer support brought timer events “considerably closer to cron’s capabilities.” That describes the feature’s direction; it does not establish complete equivalence or make timers a drop-in replacement for every cron use.

Choice Best fit How it works
Calendar timer A job tied to a calendar schedule A .timer unit uses calendar-time triggers and activates a service unit.
Monotonic timer A job timed from boot or another event A .timer unit uses elapsed-time triggers, such as time since boot or a unit’s activation.
Cron entry A job already managed with cron, or a need for cron-specific behavior Cron schedules commands through its own configuration and service rather than through systemd timer units.

The practical choice is based on the event you need: calendar timing, elapsed time from an event, or continued use of a cron-managed job. Avoid assuming that a schedule written for one system has identical behavior when moved to the other.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

How do I view logs for a systemd service?

Use journalctl with the unit filter to inspect records for a service:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
journalctl -u name.service

For example, substitute the actual service unit name for name.service. To follow new records as they arrive, use:

journalctl -f -u name.service

With no arguments, journalctl displays journal records the caller is permitted to read. Access to the system journal is permission-controlled; root and users in selected groups such as systemd-journal can read it, while other users may not. The official systemd 255 journalctl manual documents these filters and access behavior. Other systemd releases may have different manual details.

How do I see logs from the previous boot?

Use the boot selector with a negative index to view the previous boot’s records:

journalctl -b -1

To narrow that search to one service, combine the boot and unit filters:

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
journalctl -b -1 -u name.service

These commands can only show records that exist and that your account can access. Whether earlier-boot records remain available depends on journal storage configuration.

Volatile or persistent journal storage

Journald can keep records in volatile storage or use persistent storage. The official systemd 252 journald.conf manual describes journald initially using volatile storage and flushing records to /var/log/journal/ when persistent storage is enabled. Do not assume a machine retains journal entries across a reboot: inspect its effective Storage= setting and account for distribution defaults.

System journals and user journals are distinct. The journalctl --user option addresses a user’s journal, whose persistence has its own conditions; a system-wide boot query and a user-journal query are not interchangeable.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.