systemd service unit — Process lifecycle
System-level custom units usually live in /etc/systemd/system; vendor units commonly reside in /usr/lib/systemd/system. [Unit] describes relationships, [Service] describes execution, and [Install] describes enablement. Type=simple is the usual default for an ExecStart service without other type selectors; Type=oneshot waits for the start command to finish. Restart defaults to no. ExecStart is not a shell command line unless a shell is explicitly invoked. A system service normally runs as root unless configured otherwise; choose a dedicated limited identity. Drop-ins can override selected settings and list-valued settings may require an empty assignment before replacement. daemon-reload rereads unit definitions, but does not restart an existing service. After approved changes, verify, reload manager definitions, then deliberately restart only if needed and check application health. Restore the previous unit/drop-in and repeat those steps on failure. Never install this demonstration unit.
Formal Syntax & Structure
[Unit]Description=TEXT[Service]Type=TYPEExecStart=COMMANDUser=ACCOUNTRestart=POLICY[Install]WantedBy=TARGETParameters & Attributes
| Name | Type | Description |
|---|---|---|
| Description | directive | Human-readable unit purpose |
| Type | directive | Startup completion semantics |
| ExecStart | directive | Executable and arguments |
| User | directive | Runtime account |
| Restart | directive | Automatic restart policy |
| WantedBy | directive | Enablement target |
Return Value
Unit definition; offline verification is not evidence of actual execution or readiness.
Working Example
set -eud=$(mktemp -d)trap 'rm -rf -- "$d"' EXITcat > "$d/bm-example.service" <<'EOF'[Unit]Description=ByteMind offline sample[Service]Type=oneshotExecStart=/bin/trueEOFsystemd-analyze verify "$d/bm-example.service"printf 'unit verification passed\n'