конфигурация агрегата (Unit configuration)
UNIT FILE LOAD PATH
Unit files are loaded from a set of paths determined during
compilation, described in the two tables below. Unit files found
in directories listed earlier override files with the same name
in directories lower in the list.
When the variable $SYSTEMD_UNIT_PATH is set, the contents of this
variable overrides the unit load path. If $SYSTEMD_UNIT_PATH ends
with an empty component (":"), the usual unit load path will be
appended to the contents of the variable.
Table 1. Load path when running in system mode (--system).
┌──────────────────────────────┬──────────────────────────┐
│Path
│ Description
│
├──────────────────────────────┼──────────────────────────┤
│/etc/systemd/system.control │ Persistent and transient │
├──────────────────────────────┤ configuration created │
│/run/systemd/system.control │ using the dbus API │
├──────────────────────────────┼──────────────────────────┤
│/run/systemd/transient │ Dynamic configuration │
│ │ for transient units │
├──────────────────────────────┼──────────────────────────┤
│/run/systemd/generator.early │ Generated units with │
│ │ high priority (see │
│ │ early-dir in │
│ │ systemd.generator(7)) │
├──────────────────────────────┼──────────────────────────┤
│/etc/systemd/system │ System units created by │
│ │ the administrator │
├──────────────────────────────┼──────────────────────────┤
│/run/systemd/system │ Runtime units │
├──────────────────────────────┼──────────────────────────┤
│/run/systemd/generator │ Generated units with │
│ │ medium priority (see │
│ │ normal-dir in │
│ │ systemd.generator(7)) │
├──────────────────────────────┼──────────────────────────┤
│/usr/local/lib/systemd/system │ System units installed │
│ │ by the administrator │
├──────────────────────────────┼──────────────────────────┤
│/usr/lib/systemd/system │ System units installed │
│ │ by the distribution │
│ │ package manager │
├──────────────────────────────┼──────────────────────────┤
│/run/systemd/generator.late │ Generated units with low │
│ │ priority (see late-dir │
│ │ in systemd.generator(7)) │
└──────────────────────────────┴──────────────────────────┘
Table 2. Load path when running in user mode (--user).
┌────────────────────────────────────────┬──────────────────────────┐
│Path
│ Description
│
├────────────────────────────────────────┼──────────────────────────┤
│$XDG_CONFIG_HOME/systemd/user.control │ Persistent and transient │
│or │ configuration created │
│~/.config/systemd/user.control │ using the dbus API │
├────────────────────────────────────────┤ ($XDG_CONFIG_HOME is │
│$XDG_RUNTIME_DIR/systemd/user.control │ used if set, ~/.config │
│ │ otherwise) │
├────────────────────────────────────────┼──────────────────────────┤
│/run/systemd/transient │ Dynamic configuration │
│ │ for transient units │
├────────────────────────────────────────┼──────────────────────────┤
│/run/systemd/generator.early │ Generated units with │
│ │ high priority (see │
│ │ early-dir in │
│ │ systemd.generator(7)) │
├────────────────────────────────────────┼──────────────────────────┤
│$XDG_CONFIG_HOME/systemd/user or │ User configuration │
│$HOME/.config/systemd/user │ ($XDG_CONFIG_HOME is │
│ │ used if set, ~/.config │
│ │ otherwise) │
├────────────────────────────────────────┼──────────────────────────┤
│$XDG_CONFIG_DIRS/systemd/user or │ Additional configuration │
│/etc/xdg/systemd/user │ directories as specified │
│ │ by the XDG base │
│ │ directory specification │
│ │ ($XDG_CONFIG_DIRS is │
│ │ used if set, /etc/xdg │
│ │ otherwise) │
├────────────────────────────────────────┼──────────────────────────┤
│/etc/systemd/user │ User units created by │
│ │ the administrator │
├────────────────────────────────────────┼──────────────────────────┤
│$XDG_RUNTIME_DIR/systemd/user │ Runtime units (only used │
│ │ when $XDG_RUNTIME_DIR is │
│ │ set) │
├────────────────────────────────────────┼──────────────────────────┤
│/run/systemd/user │ Runtime units │
├────────────────────────────────────────┼──────────────────────────┤
│$XDG_RUNTIME_DIR/systemd/generator │ Generated units with │
│ │ medium priority (see │
│ │ normal-dir in │
│ │ systemd.generator(7)) │
├────────────────────────────────────────┼──────────────────────────┤
│$XDG_DATA_HOME/systemd/user or │ Units of packages that │
│$HOME/.local/share/systemd/user │ have been installed in │
│ │ the home directory │
│ │ ($XDG_DATA_HOME is used │
│ │ if set, ~/.local/share │
│ │ otherwise) │
├────────────────────────────────────────┼──────────────────────────┤
│$XDG_DATA_DIRS/systemd/user or │ Additional data │
│/usr/local/share/systemd/user and │ directories as specified │
│/usr/share/systemd/user │ by the XDG base │
│ │ directory specification │
│ │ ($XDG_DATA_DIRS is used │
│ │ if set, /usr/local/share │
│ │ and /usr/share │
│ │ otherwise) │
├────────────────────────────────────────┼──────────────────────────┤
│$dir/systemd/user for each $dir in │ Additional locations for │
│$XDG_DATA_DIRS │ installed user units, │
│ │ one for each entry in │
│ │ $XDG_DATA_DIRS │
├────────────────────────────────────────┼──────────────────────────┤
│/usr/local/lib/systemd/user │ User units installed by │
│ │ the administrator │
├────────────────────────────────────────┼──────────────────────────┤
│/usr/lib/systemd/user │ User units installed by │
│ │ the distribution package │
│ │ manager │
├────────────────────────────────────────┼──────────────────────────┤
│$XDG_RUNTIME_DIR/systemd/generator.late │ Generated units with low │
│ │ priority (see late-dir │
│ │ in systemd.generator(7)) │
└────────────────────────────────────────┴──────────────────────────┘
The set of load paths for the user manager instance may be
augmented or changed using various environment variables. And
environment variables may in turn be set using environment
generators, see systemd.environment-generator(7). In particular,
$XDG_DATA_HOME and $XDG_DATA_DIRS may be easily set using
systemd-environment-d-generator(8). Thus, directories listed here
are just the defaults. To see the actual list that would be used
based on compilation options and current environment use
systemd-analyze --user unit-paths
Moreover, additional units might be loaded into systemd from
directories not on the unit load path by creating a symlink
pointing to a unit file in the directories. You can use systemctl
link
for this operation. See systemctl(1) for its usage and
precaution.