Путеводитель по Руководству Linux

  User  |  Syst  |  Libr  |  Device  |  Files  |  Other  |  Admin  |  Head  |



   systemd.unit    ( 5 )

конфигурация агрегата (Unit configuration)

Технические характеристики (Specifiers)

Many settings resolve specifiers which may be used to write
       generic unit files referring to runtime or unit parameters that
       are replaced when the unit files are loaded. Specifiers must be
       known and resolvable for the setting to be valid. The following
       specifiers are understood:

Table 4. Specifiers available in unit files ┌──────────┬────────────────────┬────────────────────────┐ │Specifier Meaning Details │ ├──────────┼────────────────────┼────────────────────────┤ │"%a" │ Architecture │ A short string │ │ │ │ identifying the │ │ │ │ architecture of │ │ │ │ the local system. │ │ │ │ A string such as │ │ │ │ x86, x86-64 or │ │ │ │ arm64. See the │ │ │ │ architectures │ │ │ │ defined for │ │ │ │ ConditionArchitecture= │ │ │ │ above for a full │ │ │ │ list. │ ├──────────┼────────────────────┼────────────────────────┤ │"%A" │ Operating system │ The operating system │ │ │ image version │ image version │ │ │ │ identifier of the │ │ │ │ running system, as │ │ │ │ read from the │ │ │ │ IMAGE_VERSION= field │ │ │ │ of /etc/os-release. If │ │ │ │ not set, resolves to │ │ │ │ an empty string. See │ │ │ │ os-release(5) for more │ │ │ │ information. │ ├──────────┼────────────────────┼────────────────────────┤ │"%b" │ Boot ID │ The boot ID of the │ │ │ │ running system, │ │ │ │ formatted as string. │ │ │ │ See random(4) for more │ │ │ │ information. │ ├──────────┼────────────────────┼────────────────────────┤ │"%B" │ Operating system │ The operating system │ │ │ build ID │ build identifier of │ │ │ │ the running system, as │ │ │ │ read from the │ │ │ │ BUILD_ID= field of │ │ │ │ /etc/os-release. If │ │ │ │ not set, resolves to │ │ │ │ an empty string. See │ │ │ │ os-release(5) for more │ │ │ │ information. │ ├──────────┼────────────────────┼────────────────────────┤ │"%C" │ Cache directory │ This is either │ │ │ root │ /var/cache (for the │ │ │ │ system manager) or the │ │ │ │ path "$XDG_CACHE_HOME" │ │ │ │ resolves to (for user │ │ │ │ managers). │ ├──────────┼────────────────────┼────────────────────────┤ │"%E" │ Configuration │ This is either /etc/ │ │ │ directory root │ (for the system │ │ │ │ manager) or the path │ │ │ │ "$XDG_CONFIG_HOME" │ │ │ │ resolves to (for user │ │ │ │ managers). │ ├──────────┼────────────────────┼────────────────────────┤ │"%f" │ Unescaped filename │ This is either the │ │ │ │ unescaped instance │ │ │ │ name (if applicable) │ │ │ │ with / prepended (if │ │ │ │ applicable), or the │ │ │ │ unescaped prefix name │ │ │ │ prepended with /. This │ │ │ │ implements unescaping │ │ │ │ according to the rules │ │ │ │ for escaping absolute │ │ │ │ file system paths │ │ │ │ discussed above. │ ├──────────┼────────────────────┼────────────────────────┤ │"%g" │ User group │ This is the name of │ │ │ │ the group running the │ │ │ │ service manager │ │ │ │ instance. In case of │ │ │ │ the system manager │ │ │ │ this resolves to │ │ │ │ "root". │ ├──────────┼────────────────────┼────────────────────────┤ │"%G" │ User GID │ This is the numeric │ │ │ │ GID of the user │ │ │ │ running the service │ │ │ │ manager instance. In │ │ │ │ case of the system │ │ │ │ manager this resolves │ │ │ │ to "0". │ ├──────────┼────────────────────┼────────────────────────┤ │"%h" │ User home │ This is the home │ │ │ directory │ directory of the user │ │ │ │ running the service │ │ │ │ manager instance. In │ │ │ │ case of the system │ │ │ │ manager this resolves │ │ │ │ to "/root". │ │ │ │ │ │ │ │ Note that this setting │ │ │ │ is not influenced by │ │ │ │ the User= setting │ │ │ │ configurable in the │ │ │ │ [Service] section of │ │ │ │ the service unit. │ ├──────────┼────────────────────┼────────────────────────┤ │"%H" │ Host name │ The hostname of the │ │ │ │ running system at the │ │ │ │ point in time the unit │ │ │ │ configuration is │ │ │ │ loaded. │ ├──────────┼────────────────────┼────────────────────────┤ │"%i" │ Instance name │ For instantiated units │ │ │ │ this is the string │ │ │ │ between the first "@" │ │ │ │ character and the type │ │ │ │ suffix. Empty for │ │ │ │ non-instantiated │ │ │ │ units. │ ├──────────┼────────────────────┼────────────────────────┤ │"%I" │ Unescaped instance │ Same as "%i", but with │ │ │ name │ escaping undone. │ ├──────────┼────────────────────┼────────────────────────┤ │"%j" │ Final component of │ This is the string │ │ │ the prefix │ between the last "-" │ │ │ │ and the end of the │ │ │ │ prefix name. If there │ │ │ │ is no "-", this is the │ │ │ │ same as "%p". │ ├──────────┼────────────────────┼────────────────────────┤ │"%J" │ Unescaped final │ Same as "%j", but with │ │ │ component of the │ escaping undone. │ │ │ prefix │ │ ├──────────┼────────────────────┼────────────────────────┤ │"%l" │ Short host name │ The hostname of the │ │ │ │ running system at the │ │ │ │ point in time the unit │ │ │ │ configuration is │ │ │ │ loaded, truncated at │ │ │ │ the first dot to │ │ │ │ remove any domain │ │ │ │ component. │ ├──────────┼────────────────────┼────────────────────────┤ │"%L" │ Log directory root │ This is either │ │ │ │ /var/log (for the │ │ │ │ system manager) or the │ │ │ │ path │ │ │ │ "$XDG_CONFIG_HOME" │ │ │ │ resolves to with /log │ │ │ │ appended (for user │ │ │ │ managers). │ ├──────────┼────────────────────┼────────────────────────┤ │"%m" │ Machine ID │ The machine ID of the │ │ │ │ running system, │ │ │ │ formatted as string. │ │ │ │ See machine-id(5) for │ │ │ │ more information. │ ├──────────┼────────────────────┼────────────────────────┤ │"%M" │ Operating system │ The operating system │ │ │ image identifier │ image identifier of │ │ │ │ the running system, as │ │ │ │ read from the │ │ │ │ IMAGE_ID= field of │ │ │ │ /etc/os-release. If │ │ │ │ not set, resolves to │ │ │ │ an empty string. See │ │ │ │ os-release(5) for more │ │ │ │ information. │ ├──────────┼────────────────────┼────────────────────────┤ │"%n" │ Full unit name │ │ ├──────────┼────────────────────┼────────────────────────┤ │"%N" │ Full unit name │ Same as "%n", but with │ │ │ │ the type suffix │ │ │ │ removed. │ ├──────────┼────────────────────┼────────────────────────┤ │"%o" │ Operating system │ The operating system │ │ │ ID │ identifier of the │ │ │ │ running system, as │ │ │ │ read from the ID= │ │ │ │ field of │ │ │ │ /etc/os-release. See │ │ │ │ os-release(5) for more │ │ │ │ information. │ ├──────────┼────────────────────┼────────────────────────┤ │"%p" │ Prefix name │ For instantiated │ │ │ │ units, this refers to │ │ │ │ the string before the │ │ │ │ first "@" character of │ │ │ │ the unit name. For │ │ │ │ non-instantiated │ │ │ │ units, same as "%N". │ ├──────────┼────────────────────┼────────────────────────┤ │"%P" │ Unescaped prefix │ Same as "%p", but with │ │ │ name │ escaping undone. │ ├──────────┼────────────────────┼────────────────────────┤ │"%s" │ User shell │ This is the shell of │ │ │ │ the user running the │ │ │ │ service manager │ │ │ │ instance. In case of │ │ │ │ the system manager │ │ │ │ this resolves to │ │ │ │ "/bin/sh". │ ├──────────┼────────────────────┼────────────────────────┤ │"%S" │ State directory │ This is either │ │ │ root │ /var/lib (for the │ │ │ │ system manager) or the │ │ │ │ path │ │ │ │ "$XDG_CONFIG_HOME" │ │ │ │ resolves to (for user │ │ │ │ managers). │ ├──────────┼────────────────────┼────────────────────────┤ │"%t" │ Runtime directory │ This is either /run/ │ │ │ root │ (for the system │ │ │ │ manager) or the path │ │ │ │ "$XDG_RUNTIME_DIR" │ │ │ │ resolves to (for user │ │ │ │ managers). │ ├──────────┼────────────────────┼────────────────────────┤ │"%T" │ Directory for │ This is either /tmp or │ │ │ temporary files │ the path "$TMPDIR", │ │ │ │ "$TEMP" or "$TMP" are │ │ │ │ set to. (Note that the │ │ │ │ directory may be │ │ │ │ specified without a │ │ │ │ trailing slash.) │ ├──────────┼────────────────────┼────────────────────────┤ │"%u" │ User name │ This is the name of │ │ │ │ the user running the │ │ │ │ service manager │ │ │ │ instance. In case of │ │ │ │ the system manager │ │ │ │ this resolves to │ │ │ │ "root". │ │ │ │ │ │ │ │ Note that this setting │ │ │ │ is not influenced by │ │ │ │ the User= setting │ │ │ │ configurable in the │ │ │ │ [Service] section of │ │ │ │ the service unit. │ ├──────────┼────────────────────┼────────────────────────┤ │"%U" │ User UID │ This is the numeric │ │ │ │ UID of the user │ │ │ │ running the service │ │ │ │ manager instance. In │ │ │ │ case of the system │ │ │ │ manager this resolves │ │ │ │ to "0". │ │ │ │ │ │ │ │ Note that this setting │ │ │ │ is not influenced by │ │ │ │ the User= setting │ │ │ │ configurable in the │ │ │ │ [Service] section of │ │ │ │ the service unit. │ ├──────────┼────────────────────┼────────────────────────┤ │"%v" │ Kernel release │ Identical to uname -r │ │ │ │ output. │ ├──────────┼────────────────────┼────────────────────────┤ │"%V" │ Directory for │ This is either │ │ │ larger and │ /var/tmp or the path │ │ │ persistent │ "$TMPDIR", "$TEMP" or │ │ │ temporary files │ "$TMP" are set to. │ │ │ │ (Note that the │ │ │ │ directory may be │ │ │ │ specified without a │ │ │ │ trailing slash.) │ ├──────────┼────────────────────┼────────────────────────┤ │"%w" │ Operating system │ The operating system │ │ │ version ID │ version identifier of │ │ │ │ the running system, as │ │ │ │ read from the │ │ │ │ VERSION_ID= field of │ │ │ │ /etc/os-release. If │ │ │ │ not set, resolves to │ │ │ │ an empty string. See │ │ │ │ os-release(5) for more │ │ │ │ information. │ ├──────────┼────────────────────┼────────────────────────┤ │"%W" │ Operating system │ The operating system │ │ │ variant ID │ variant identifier of │ │ │ │ the running system, as │ │ │ │ read from the │ │ │ │ VARIANT_ID= field of │ │ │ │ /etc/os-release. If │ │ │ │ not set, resolves to │ │ │ │ an empty string. See │ │ │ │ os-release(5) for more │ │ │ │ information. │ ├──────────┼────────────────────┼────────────────────────┤ │"%%" │ Single percent │ Use "%%" in place of │ │ │ sign │ "%" to specify a │ │ │ │ single percent sign. │ └──────────┴────────────────────┴────────────────────────┘