whatis unit-file

systemd Unit File

Also known as: service file, .service, unit

An INI-style file describing something systemd manages, such as a service, timer, mount, or socket, with its dependencies and settings.

What Is a systemd Unit File?

A .service file has [Unit] (description, ordering), [Service] (the command, user, restart policy, sandboxing), and [Install] (which target enables it) sections. Other types include .timer, .socket, .mount, and .target.

Put your own units in /etc/systemd/system/, run systemctl daemon-reload, then systemctl enable --now name. systemctl edit name creates a drop-in override instead of editing the packaged file.

Example

[Service]
ExecStart=/usr/local/bin/app
Restart=on-failure
User=app