$linuxjunkies
>

path unit

also: path activation, .path unit

A systemd unit type that monitors a file or directory and triggers an associated service when the path changes. Path units enable event-driven automation by watching for file modifications, creation, or deletion.

A path unit is a systemd unit file with a .path extension that monitors the filesystem for changes to a specific file or directory. When the monitored path meets a condition (such as being created, modified, or deleted), systemd automatically activates an associated service unit to handle the event.

Path units use conditions like PathExists, PathExistsGlob, PathChanged, and PathModified to define what triggers activation. For example, a path unit might watch /var/spool/mail/user and launch a mail-processing service whenever a new message arrives.

A typical path unit file includes a [Path] section with monitoring directives and a [Unit] section that specifies which service to activate via the Unit= directive. Path units are commonly used for log rotation, backup triggers, and device hotplug handling.

Related terms