Free tools Windows power users keep installed

One-click scans. No signup required.

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

A systemd unit file is a plain-text INI-style configuration file. Put shared metadata and relationships in [Unit], service behavior in [Service], timer scheduling in [Timer], and boot-enablement metadata in [Install]. The examples below show a long-running service, a scheduled one-shot job, and how to express dependencies without confusing startup requirements with ordering.

Systemd directives and defaults vary by release. Check the manuals installed on your Linux distribution before using a directive or relying on a default; upstream manuals may describe a newer version than your system.

Where do systemd unit files go?

For a system-wide unit created by an administrator, save the file in /etc/systemd/system/. Give it the unit type as its extension: .service for a service or .timer for a timer. A service and its timer commonly share a basename, such as example-cleanup.service and example-cleanup.timer.

A unit file is divided into named sections. [Unit] holds descriptive metadata and relationships to other units; [Service] defines how a service process runs; [Timer] defines when a timer activates a unit; and [Install] describes how a unit can be connected to a target by enablement operations. Not every unit needs every section. See the upstream systemd.unit(5) manual and your distribution’s locally installed manual pages for section and directive details.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

How do I write a systemd service file?

Long-running service example

Save this illustrative example as /etc/systemd/system/example-daemon.service, changing the description and executable path for your system:

[Unit]
Description=Example background service

[Service]
Type=simple
ExecStart=/usr/local/bin/example-daemon
Restart=on-failure

[Install]
WantedBy=multi-user.target

ExecStart= must point to an executable that exists and can be run by the service. Choose Type= to match how the program behaves: this example uses simple for a process managed as the service’s main process, but it is not the right choice for every daemon. Service types affect how systemd interprets startup and readiness, and ExecStart= behavior also depends on the type. Consult the installed systemd.service(5) manual; the upstream reference is systemd.service(5).

Restart=on-failure requests restart behavior for failure conditions; check the local service manual for its exact semantics and interactions with other settings. WantedBy=multi-user.target is installation metadata used when enabling this service to start through that target. It does not itself start the service when the file is written.

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.

One-shot task example

For a command that performs a task and exits, use a one-shot service. A timer can then activate it on a schedule:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
# /etc/systemd/system/example-cleanup.service
[Unit]
Description=Example cleanup task

[Service]
Type=oneshot
ExecStart=/usr/local/sbin/example-cleanup

As with the long-running example, replace the executable path with a valid command on your machine. Type=oneshot is intended for a service action that completes and exits rather than remaining as a continuously running process.

How do I create and enable a systemd timer?

Calendar timer example

Save the following as /etc/systemd/system/example-cleanup.timer:

Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
[Unit]
Description=Run example cleanup daily

[Timer]
OnCalendar=daily
Persistent=true

[Install]
WantedBy=timers.target

A timer normally activates a same-basename .service by default, so this timer activates example-cleanup.service. Set Unit= in [Timer] if it should activate a differently named unit. The upstream systemd.timer(5) manual documents timer directives, including the precise missed-run behavior of Persistent=; consult the copy installed for your release before depending on that behavior.

OnCalendar= expresses a wall-clock schedule. Timer units can also use monotonic directives, which schedule relative to elapsed time or another timer-related event rather than a calendar time. These are different scheduling models, not interchangeable spellings; check the local timer manual for supported directives and syntax.

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

Enable the unit that should be active automatically

To load the schedule at boot, enable the timer. A service activated only by that timer generally does not need its own boot-enablement relationship; enable the service separately only if you also want it pulled in directly at boot.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
  1. Refresh systemd’s view after adding or changing unit files: run sudo systemctl daemon-reload.
  2. Enable the timer for automatic activation: run sudo systemctl enable --now example-cleanup.timer. Use sudo systemctl enable example-cleanup.timer if you only want to enable it now and start it later.
  3. Check its schedule: run systemctl list-timers.
  4. Inspect the timer or service: run systemctl status example-cleanup.timer or systemctl status example-cleanup.service.
  5. Review service logs: run journalctl -u example-cleanup.service.

Enablement uses the unit’s [Install] metadata to connect it to a target; it is distinct from starting a unit immediately. For command options and behavior supported by your installation, consult the local systemctl(1) manual. The upstream command reference is systemctl(1).

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

How do I make a service start after another service?

Use ordering directives for sequence. In the unit that must start later, add After=other.service. Use Before=other.service when this unit should be ordered before the named unit. Neither directive by itself pulls the other unit into the activation transaction.

To ask systemd to start another unit as a dependency, use Wants= or Requires=. Requirement and ordering are independent: a dependency can be requested without ordering, and ordering alone does not request activation. The upstream systemd.unit(5) dependency documentation states: “Note that requirement dependencies do not influence the order in which services are started or stopped.”

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
Directive What it expresses When to use it
Wants=other.service A weaker activation requirement: when this unit is activated, systemd also tries to activate the other unit. Use when the other unit is useful but should not be treated as a strict prerequisite.
Requires=other.service A stronger requirement relationship than Wants=; it does not, by itself, establish startup order or guarantee that the other unit remains active in every situation. Use when the required unit’s failure relationship should affect whether this unit starts. Pair it with ordering when sequence matters.
After=other.service Orders this unit after the named unit if both are being started. Use when this service must start later than the other one.
Before=other.service Orders this unit before the named unit if both are being started. Use when this service must start earlier than the other one.

Soft dependency with ordering

To request a backend and order this unit after it, add this to the dependent unit’s [Unit] section:

Wants=example-backend.service
After=example-backend.service

Required dependency with ordering

If failure of the backend should prevent this unit from starting, use the stronger requirement instead:

Requires=example-backend.service
After=example-backend.service

Use Requires= only when that stronger relationship matches the desired failure behavior; it is not simply a way to make startup happen first.

How do I validate and troubleshoot a unit file?

Before relying on a new unit, verify its syntax and inspect what systemd reports on the installed release. The available checks and their output can vary by version.

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.
  1. Ask the installed verifier to check the file, if supported: run sudo systemd-analyze verify /etc/systemd/system/example-cleanup.service /etc/systemd/system/example-cleanup.timer. Confirm syntax and supported options against the local systemd-analyze(1) manual.
  2. Reload after editing: run sudo systemctl daemon-reload.
  3. Check the relevant unit’s state: use systemctl status UNIT, substituting the exact unit name.
  4. Inspect activation relationships: use systemctl list-dependencies UNIT to see dependencies in the manager’s view.
  5. Read service logs: use journalctl -u name.service, replacing the example with the service’s actual name.

Common causes of problems include a misspelled or unsupported directive, a missing or non-executable ExecStart= target, invalid calendar syntax, or enabling the service instead of the timer when only scheduled activation is wanted. If a service must wait for a dependency, check that an ordering directive such as After= is present as well as the requirement directive. When behavior differs from an example, compare it with the manuals installed on your distribution rather than assuming the latest upstream defaults apply.

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.