Build systemd units with the right options
A systemd unit file is an INI-style description of a service, socket, timer or
other resource. Each option lives in a section and has a specific value type and
default. This tool is a searchable reference to the most-used options across the
[Unit], [Install], [Service], [Socket] and [Timer] sections, so you can
confirm exactly what to write before reloading the daemon.
How it works
Options are written as Key=Value lines under a [Section] header. The [Unit]
section carries the description and dependency/ordering directives (Requires,
Wants, After, Before). The [Install] section controls what systemctl enable wires up, most commonly WantedBy=multi-user.target. The type-specific
section does the real work: [Service] defines ExecStart, the start-up Type
and the Restart policy; [Socket] declares the addresses to listen on for
socket activation; and [Timer] schedules activation with OnCalendar or
OnBootSec. Time values accept suffixes like ms, s, min and h, and
boolean options accept yes/no/true/false/1/0. After editing a unit run
systemctl daemon-reload for changes to take effect.
Tips and notes
Prefer Restart=on-failure over Restart=always so a clean systemctl stop does
not trigger a restart loop. When a service must wait for the network, pair
After=network-online.target with Wants=network-online.target — network.target
alone does not guarantee connectivity. For one-shot setup tasks use
Type=oneshot with RemainAfterExit=yes so the unit shows as active after it
finishes. And remember a unit needs an [Install] section to be enabled at all;
without WantedBy or RequiredBy, systemctl enable has nothing to link.