CertGrid CertGrid
Hands-on Lab·Linux Foundation Certified System Administrator

Writing a unit, and what ordering means

Writing a unit is a task you will be given, and the marks are in the parts that are not the ExecStart line: the environment your script gets, whether a failure is recorded, and the difference between needing another unit and running after it. This guide writes one, breaks one deliberately, and then modifies a unit without editing it.

Operations Deployment Guide 14 of 38 Intermediate

systemd 257 on RHEL 10; identical on the lab's Ubuntu 259 hosts. systemd-analyze verify and drop-in directories have been stable for years.

Both families. The RHEL transcript came first, during an outage that took both Ubuntu hosts offline; the Ubuntu half was captured afterwards and is the last step of each page, because Ubuntu is what LFCS is most likely to sit you in front of.
Server NameIP AddressOSRolesCPURAMHDD
LFCS-A01192.168.0.70Ubuntu 26.04 LTSPrimary host - most guides run only here2 Core4 GB50 GB
LFCS-C01192.168.0.72AlmaLinux 10.2The other distribution - dnf, firewalld and NetworkManager2 Core4 GB50 GB

This guide includes

Use this because writing a unit is a task you will be given. This matters because Requires is not After - a unit can require another and still start before it.

Before you start

  1. A script, and a unit that runs it

  2. daemon-reload, and then what the unit gave the script

  3. A unit that fails, and what systemd remembers

  4. Requires is not After

  5. A drop-in, instead of editing the unit

  6. The same unit file on Ubuntu

Official sources