SYSTEMD.UNIT(5) systemd.unit SYSTEMD.UNIT(5) (NAME) systemd.unit - systemd (SYNOPSIS) service.service, socket.socket, device.device, mount.mount, automount.automount, swap.swap, target.target, path.path, timer.timer, slice.slice, scope.scope (System Unit Search Path) /etc/systemd/system.control/* /run/systemd/system.control/* /run/systemd/transient/* /run/systemd/generator.early/* /etc/systemd/system/* /etc/systemd/system.attached/* /run/systemd/system/* /run/systemd/system.attached/* /run/systemd/generator/* ... /usr/local/lib/systemd/system/* /usr/lib/systemd/system/* /run/systemd/generator.late/* (User Unit Search Path) ~/.config/systemd/user.control/* $XDG_RUNTIME_DIR/systemd/user.control/* $XDG_RUNTIME_DIR/systemd/transient/* $XDG_RUNTIME_DIR/systemd/generator.early/* ~/.config/systemd/user/* $XDG_CONFIG_DIRS/systemd/user/* /etc/systemd/user/* $XDG_RUNTIME_DIR/systemd/user/* /run/systemd/user/* $XDG_RUNTIME_DIR/systemd/generator/* $XDG_DATA_HOME/systemd/user/* $XDG_DATA_DIRS/systemd/user/* ... /usr/local/lib/systemd/user/* /usr/lib/systemd/user/* $XDG_RUNTIME_DIR/systemd/generator.late/* (DESCRIPTION) ini (mount point) (automount point) swap (target) systemd(1) (slice) . systemd.syntax(7) . . [Unit] [Install] . [Unit] [Install] [Service] . : systemd.service(5) systemd.socket(5) systemd.device(5) systemd.mount(5) systemd.automount(5) systemd.swap(5) systemd.target(5) systemd.path(5) systemd.timer(5) systemd.slice(5) systemd.scope(5). . << >> . << >> ( ":" "-" "_" "." "\") . . : ".service" ".socket" ".device" ".mount" ".automount" ".swap" ".target" ".path" ".timer" ".slice" ".scope". << >> (instance name) . << >> (template file) . "@" ( ) . "@" . "%i" . . systemd . X- systemd . . . . (symlink) ( ). systemd-networkd.service dbus-org.freedesktop.network1.service systemd D-Bus dbus-org.freedesktop.network1.service systemd-networkd.service . default.target -- -- multi-user.target graphical.target . disable start stop status Wants= Requires= Before= After= . preset . : (".service" ".socket" ...) . ( ) . . ( ). ( "alias@inst.service") ( "template@inst.service") . ( "alias@foo.service" "alias@bar.service") . ( ) . . (dangling) . Alias= [Install] . (enable) (disable) . reboot.target Alias=ctrl-alt-del.target /etc/systemd/system/ctrl-alt-del.target reboot.target Ctrl+Alt+Del systemd ctrl-alt-del.target reboot.target reboot.service . systemd [Install] . foo.service foo.service.wants/ . Wants= . Requires= .requires/ . . Wants= Requires= . .wants/ .requires/ [Install] enable preset systemctl(1) . ( ). <<>> . .wants/ .requires/ . . foo.service (drop-in) foo.service.d/ . ".conf" - . . drop-in . ".d/" ( "foo@bar.service.d/") ".conf" ".d/" ( "foo@.service.d/") ".conf" . ("-") . foo-bar-baz.service drop-in foo-bar-baz.service.d/ foo-bar-.service.d/ foo-.service.d/ . . mount automount slice . drop-in foo-bar-.service.d/10-override.conf foo-.service.d/10-override.conf . ( ) drop-in . default.target graphical.target default.target.d/ default.target.wants/ default.target.requires/ graphical.target.d/ graphical.target.wants/ graphical.target.requires/ . drop-in . drop-in . /etc/systemd/system ".d/" /usr/lib/systemd/system /run/systemd/system . drop-in /etc/ /run/ /usr/lib/ . drop-in . drop-in . type.d/ type "service" "socket" . drop-in . type.d/ . : drop-in type.d/ drop-in (mask) . . systemd (bus) . . . systemd . "@" systemd ( "@" ) . : getty@tty3.service systemd getty@.service . "%i" . . ( ) /dev/null "masked" () . . (Interface Portability and Stability Promise)[1] . (STRING ESCAPING FOR INCLUSION IN UNIT NAMES) . (string escaping) ( NUL) . . : dev-sda.device /dev/sda . : "/" "-" - ":" "_" "." C "\x2d" . "." C . : "/" "-" . "/" . : /foo//bar/baz/ "foo-bar-baz". ( ). systemd-escape(1) . systemd-escape --path systemd-escape --path . (AUTOMATIC DEPENDENCIES) (Implicit Dependencies) . . << >> . Type=dbus Requires= After= dbus.socket . systemd.service(5) . (Default Dependencies) DefaultDependencies= yes () no . DefaultDependencies= << >> . Wants= Requires= After= . systemd.target(5) . DefaultDependencies=no Before= . (UNIT FILE LOAD PATH) . [2]. $SYSTEMD_UNIT_PATH . $SYSTEMD_UNIT_PATH (":") . . (--system). +------------------------------+----------------------------+ | | | +------------------------------+----------------------------+ |/etc/systemd/system.control | | | | | | | | | | | | | API - | | | | | | | +------------------------------+ | |/run/systemd/system.control | | +------------------------------+----------------------------+ |/run/systemd/transient | | | | | | | | | | | +------------------------------+----------------------------+ |/run/systemd/generator.early | | | | | | | | | | ( | | | early-dir | | | systemd.generator(7) | | | | | | ) | +------------------------------+----------------------------+ |/etc/systemd/system | | | | | | | | | | | | | | +------------------------------+----------------------------+ |/run/systemd/system | | | | | +------------------------------+----------------------------+ |/run/systemd/generator | | | | | | | | | | ( | | | normal-dir | | | systemd.generator(7) | | | | | | ) | +------------------------------+----------------------------+ |/usr/local/lib/systemd/system | | | | | | | | | | | | | | +------------------------------+----------------------------+ |/usr/lib/systemd/system | | | | | | | | | | | | | | | | | +------------------------------+----------------------------+ |/run/systemd/generator.late | | | | | | | | | | ( | | | late-dir | | | systemd.generator(7) | | | | | | ) | +------------------------------+----------------------------+ . (--user). +-----------------------------------------+-----------------------------------------+ | | | +-----------------------------------------+-----------------------------------------+ |$XDG_CONFIG_HOME/systemd/user.control or | | |~/.config/systemd/user.control | | | | | | | API | | | - ( | | | $XDG_CONFIG_HOME | | | | | | | | | ~/.config) | +-----------------------------------------+ | |$XDG_RUNTIME_DIR/systemd/user.control | | +-----------------------------------------+-----------------------------------------+ |$XDG_RUNTIME_DIR/systemd/transient | | | | | | | | +-----------------------------------------+-----------------------------------------+ |$XDG_RUNTIME_DIR/systemd/generator.early | | | | | | | ( | | | early-dir systemd.generator(7) | | | ) | +-----------------------------------------+-----------------------------------------+ |$XDG_CONFIG_HOME/systemd/user or | | |$HOME/.config/systemd/user | ( | | | $XDG_CONFIG_HOME | | | | | | | | | ~/.config) | +-----------------------------------------+-----------------------------------------+ |$XDG_CONFIG_DIRS/systemd/user or | | |/etc/xdg/systemd/user | | | | | | | | | | | | | XDG ( | | | $XDG_CONFIG_DIRS | | | | | | | | | /etc/xdg) | +-----------------------------------------+-----------------------------------------+ |/etc/systemd/user | | | | | | | | | | | +-----------------------------------------+-----------------------------------------+ |$XDG_RUNTIME_DIR/systemd/user | | | | ( | | | | | | | | | $XDG_RUNTIME_DIR | | | ) | +-----------------------------------------+-----------------------------------------+ |/run/systemd/user | | | | | +-----------------------------------------+-----------------------------------------+ |$XDG_RUNTIME_DIR/systemd/generator | | | | | | | | | | ( normal-dir | | | systemd.generator(7) | | | ) | +-----------------------------------------+-----------------------------------------+ |$XDG_DATA_HOME/systemd/user or | | |$HOME/.local/share/systemd/user | | | | | | | | | | ( | | | | | | $XDG_DATA_HOME | | | | | | ~/.local/share) | +-----------------------------------------+-----------------------------------------+ |$XDG_DATA_DIRS/systemd/user or | | |/usr/local/share/systemd/user and | | |/usr/share/systemd/user | | | | | | | XDG ( | | | $XDG_DATA_DIRS | | | | | | | | | /usr/local/share | | | /usr/share) | +-----------------------------------------+-----------------------------------------+ |$dir/systemd/user for each $dir in | | |$XDG_DATA_DIRS | | | | | | | | | | | | | | | | $XDG_DATA_DIRS | +-----------------------------------------+-----------------------------------------+ |/usr/local/lib/systemd/user | | | | | | | | | | | +-----------------------------------------+-----------------------------------------+ |/usr/lib/systemd/user | | | | | | | | | | | | | | +-----------------------------------------+-----------------------------------------+ |$XDG_RUNTIME_DIR/systemd/generator.late | | | | | | | | | | ( late-dir | | | systemd.generator(7) | | | ) | +-----------------------------------------+-----------------------------------------+ . (environment generators) systemd.environment-generator(7) . $XDG_DATA_HOME $XDG_DATA_DIRS systemd-environment-d-generator(8) . . : systemd-analyze --user unit-paths systemd . systemctl link systemctl(1) . systemd ( /home/ /var/ ). << >> (linked unit files) << >> (unit file aliases) : (target) : . . ( ). /etc/systemd/system/alias1.service -> service1.service /etc/systemd/system/alias2.service -> /usr/lib/systemd/service1.service /etc/systemd/system/alias3.service -> /etc/systemd/system/service1.service service1.service /run/systemd/system/service1.service . /etc/systemd/system/link1.service -> ../link1_service_file link1.service << >> /etc/systemd/link1_service_file . (UNIT GARBAGE COLLECTION) . (<< >> garbage collection). : 1. After= Wants= ... . 2. . 3. failed () . ( .) 4. (job) . 5. IPC . 6. <<>> (perpetual) . -.mount scope init.scope . 7. . CollectMode= failed . . systemctl daemon-reload . ( ) / . [UNIT] ([UNIT] SECTION OPTIONS) [Unit] : Description= . systemd ( ) . . "Apache2 Web Server" . "high-performance lightweight HTTP server" ( ) "Apache2" ( ). systemd ("Starting description...", "Started description.", "Reached target description.", "Failed to start description.") ( ) . "exiting the container" "updating the database once per day." . . Documentation= URI . URI "http://" "https://" "file:" "info:" "man:" . URI uri(7) . URI . . URI . . . Wants= () . . .wants/ . . . . . . After= Before= . foo.service bar.service Wants= After= Before= foo.service . . Requires= Wants= . .requires/ . . After= . After= ( ) ( ) . Wants= Requires= . . : ( ConditionPathExists= ConditionPathIsSymbolicLink= ... -- ) Requires= . ( ) Requires= . BindsTo= After= ( ). . Requisite= Requires=. . Requisite= . After= . Requisite=b.service a.service RequisiteOf=a.service b.service . RequisiteOf= . . BindsTo= Requires= . : Requires= ( ) ( ) ( ) . : mount (unmount) . After= BindsTo= . . ( ConditionPathExists= ConditionPathIsSymbolicLink= ... -- ) . BindsTo= After= . BindsTo=b.service a.service BoundBy=a.service b.service . BoundBy= . . PartOf= Requires= . systemd . -- . PartOf=b.service a.service ConsistsOf=a.service b.service . ConsistsOf= . . Upholds= Wants= Upholds= . Wants= Upholds= . Restart= . . Upholds=b.service a.service UpheldBy=a.service b.service . . Conflicts= . . Conflicts= . Wants= Requires= . After= Before= . Before=/After= . A B B ( ) ( ). . . Before=, After= . . . foo.service Before=bar.service bar.service foo.service . After= Before= Before= After= . . After= . . After= Before=. . . . Before=/After= . ExecStartPost= ( ExecStopPost= ) . Requires= Wants= Requisite= BindsTo= . After= Wants= . Before= . (hotplug) systemd . . OnFailure= "failed" () . . OnSuccess= "inactive" () . . PropagatesReloadTo=, ReloadPropagatedFrom= . . . PropagatesStopTo=, StopPropagatedFrom= . . . JoinsNamespaceOf= ( ) / . ( a.service JoinsNamespaceOf=b.service ) (JoinsNamespaceOf=a.service b.service) . PrivateNetwork= NetworkNamespacePath= PrivateIPC= IPCNamespacePath= PrivateTmp= ( systemd.exec(5) ). /tmp/ /var/tmp/ IPC . . PrivateNetwork=/NetworkNamespacePath= PrivateIPC=/IPCNamespacePath= / PrivateTmp= . . RequiresMountsFor= . Requires= After= (mount) . noauto local-fs.target . . WantsMountsFor= RequiresMountsFor= Wants= Requires= . . OnSuccessJobMode=, OnFailureJobMode= "fail" "replace" "replace-irreversibly" "isolate" "flush" "ignore-dependencies" "ignore-requirements" . "replace" . OnSuccess=/OnFailure= . --job-mode= systemctl(1) . "isolate" OnSuccess=/OnFailure= . . IgnoreOnIsolate= . true . false slice scope swap mount automount true . . StopWhenUnneeded= . true . systemd . . false . . RefuseManualStart=, RefuseManualStop= . true . . . false . . AllowIsolate= . true systemctl isolate . . (runlevels) SysV init . false . . DefaultDependencies= . yes () . . . . no . . no . . SurviveFinalKillSignal= . no . yes "SIGTERM" "SIGKILL" . "argv[0][0] = '@'" systemd [3] . . CollectMode= << >> . inactive inactive-or-failed . inactive inactive -- failed . failed systemctl reset-failed failed . inactive-or-failed : failed failed . ( ...) . inactive . . FailureAction=, SuccessAction= (failed) (inactive) . none reboot reboot-force reboot-immediate poweroff poweroff-force poweroff-immediate exit exit-force soft-reboot soft-reboot-force kexec kexec-force halt halt-force halt-immediate . . none exit exit-force . none . none . reboot ( systemctl reboot). reboot-force ( systemctl reboot -f) reboot-immediate reboot(2) ( systemctl reboot -ff). poweroff poweroff-force poweroff-immediate kexec kexec-force halt halt-force halt-immediate kexec . exit exit-force . exit exit-force ( ) . FailureActionExitStatus=/SuccessActionExitStatus= . soft-reboot . soft-reboot-force . . FailureActionExitStatus=, SuccessActionExitStatus= ( ) ( ) FailureAction=/SuccessAction= exit exit-force . ( ) . ... . . JobTimeoutSec=, JobRunningTimeoutSec= JobTimeoutSec= . JobRunningTimeoutSec= . "failed" . systemd.time(7) . "infinity" ( ) JobRunningTimeoutSec= DefaultDeviceTimeoutSec= . : ( TimeoutStartSec= ). . : . . . JobTimeoutAction=, JobTimeoutRebootArgument= JobTimeoutAction= JobTimeoutSec= JobRunningTimeoutSec= . FailureAction=/SuccessAction= . none . JobTimeoutRebootArgument= reboot(2) . . StartLimitIntervalSec=interval, StartLimitBurst=burst . burst interval . StartLimitIntervalSec= StartLimitBurst= . interval systemd.time(7) . "infinity" . DefaultStartLimitIntervalSec= . burst DefaultStartLimitBurst= . Restart= ( systemd.service(5) ) ( ) Restart= . Restart= interval . . systemctl reset-failed . . ( ) . . slice target device scope . . StartLimitAction= StartLimitIntervalSec= StartLimitBurst= . FailureAction=/SuccessAction= . none . none . . RebootArgument= reboot(2) StartLimitAction= FailureAction= . systemctl reboot . . SourcePath= . (generator) . . . (Conditions and Asserts) Condition...= Assert...= . systemd . ( ) ( ) ( ). "failed" . . . . ( AND ). ("|") ("Condition...=|...") (triggering) . ( ) . . ( ) . AssertArchitecture= AssertVirtualization= ... ( ). . . . . . . condition systemd-analyze(1) . ConditionPathIsSymbolicLink= . ConditionArchitecture= . : "x86" "x86-64" "ppc" "ppc-le" "ppc64" "ppc64-le" "ia64" "parisc" "parisc64" "s390" "s390x" "sparc" "sparc64" "mips" "mips-le" "mips64" "mips64-le" "alpha" "arm" "arm-be" "arm64" "arm64-be" "sh" "sh64" "m68k" "tilegx" "cris" "arc" "arc-be" "native". systemd-analyze(1) . uname(2) personality(2) . Personality= . "native" . . . ConditionFirmware= (firmware) . : o "uefi" EFI . o "device-tree" (Device Tree) . o "device-tree-compatible(value)" "value" . o "smbios-field(field operator value)" SMBIOS . field SMBIOS "sysfs" /sys/class/dmi/id/ . operator "<" "<=" ">=" ">" "==" "<>" "=" "!=" "$=" "!$=" (glob) . value SMBIOS ( glob "$="/"!$=" ). . ConditionVirtualization= . "vm" "container" "qemu" "kvm" "amazon" "zvm" "vmware" "microsoft" "oracle" "powervm" "xen" "bochs" "uml" "bhyve" "qnx" "apple" "sre" "openvz" "lxc" "lxc-libvirt" "systemd-nspawn" "docker" "podman" "rkt" "wsl" "proot" "pouch" "acrn" "private-users" . systemd-detect-virt(1) . . . . ConditionHost= ConditionHost= (hostname) (machine ID) . ( ) gethostname(2) ( machine-id(5) ). . . ConditionKernelCommandLine= ConditionKernelCommandLine= ( -- ) . ( "=" ). . . /proc/cmdline PID 1 ( /proc/1/cmdline). . ConditionKernelVersion= ConditionKernelVersion= ( uname -r ) . ( ) . "=" "!=" "<" "<=" "==" "<>" ">=" ">" "$=" "!$=" . "$=" . (backport) . . . ConditionCredential= ConditionCredential= (credential) . [4] . . unit@.service . . . ConditionEnvironment= ConditionEnvironment= ( -- ) . ("name=value") . Environment= EnvironmentFile= . PAM . . ConditionSecurity= ConditionSecurity= . : . +----------------+-----------------------------------------------+ | | | +----------------+-----------------------------------------------+ |selinux | | | | SELinux | +----------------+-----------------------------------------------+ |apparmor | | | | AppArmor | +----------------+-----------------------------------------------+ |tomoyo | | | | Tomoyo | +----------------+-----------------------------------------------+ |smack | | | | SMACK | +----------------+-----------------------------------------------+ |ima | | | | | | | (IMA) | +----------------+-----------------------------------------------+ |audit | | | | (Linux Audit Framework) | +----------------+-----------------------------------------------+ |uefi-secureboot | UEFI | | | (UEFI SecureBoot) | +----------------+-----------------------------------------------+ |tpm2 | | | | | | | . (TPM2) | +----------------+-----------------------------------------------+ |cvm | | | | (SEV/TDX) | +----------------+-----------------------------------------------+ |measured-uki | | | | | | | | | | PCR 11 systemd-stub(7). | | | | | | . | +----------------+-----------------------------------------------+ . . ConditionCapability= (capability) ( capabilities(7) ). "CAP_MKNOD" . . ConditionACPower= (AC) . . "true" AC AC . "false" AC AC . . ConditionNeedsUpdate= /var/ /etc/ "!" ( ) . /usr/ .updated . /usr/ /etc/ /var/ . systemd-update- done.service(8) . systemd.condition_needs_update= ( ) . systemd-update-done.service ConditionNeedsUpdate= . /usr/ . mtime /usr/ . /usr/ . . ConditionNeedsUpdate= . . ConditionFirstBoot= . . /etc/ ( "First Boot Semantics" machine-id(5) ). ( ). /etc/ . : machine-id(5) (preset) systemd.preset(5) . ConditionFirstBoot=yes . ConditionFirstBoot=yes first-boot-complete.target Wants= . . systemd.condition_first_boot= ( ) /etc/machine-id . . ConditionPathExists= . . ConditionPathExists= ("!") . . ConditionPathExistsGlob= ConditionPathExistsGlob= ConditionPathExists= glob . . ConditionPathIsDirectory= ConditionPathIsDirectory= ConditionPathExists= . . ConditionPathIsSymbolicLink= ConditionPathIsSymbolicLink= ConditionPathExists= . . ConditionPathIsMountPoint= ConditionPathIsMountPoint= ConditionPathExists= (mount point) . . ConditionPathIsReadWrite= ConditionPathIsReadWrite= ConditionPathExists= ( ). . ConditionPathIsEncrypted= ConditionPathIsEncrypted= ConditionPathExists= dm-crypt/LUKS . ext4 . loopback loopback . loopback . . ConditionDirectoryNotEmpty= ConditionDirectoryNotEmpty= ConditionPathExists= . . ConditionFileNotEmpty= ConditionFileNotEmpty= ConditionPathExists= . . ConditionFileIsExecutable= ConditionFileIsExecutable= ConditionPathExists= . . ConditionUser= ConditionUser= "UID" "@system" . . "@system" . root . . ConditionGroup= ConditionGroup= ConditionUser= GID . "@system" . . ConditionControlGroupController= cgroup ( "cpu") v1 cgroup v2 cgroup . . systemd . "cpu" "io" "memory" "pids". cgroup_disable=controller . "v1" "v2" ( ). "v2" v2 cgroup "v1" v1 . . systemd(1) . . ConditionMemory= . "<" "<=" "=" ( "==") "!=" ( "<>") ">=" ">" . . . . ConditionCPUs= CPU . CPU "<" "<=" "=" ( "==") "!=" ( "<>") ">=" ">" . CPU CPU . CPU CPU . CPU CPU . . ConditionCPUFeature= CPU "CPUID" . i386 x86-64 . CPU . "1" "7" "0x80000001" "0x80000007" . : "fpu" "vme" "de" "pse" "tsc" "msr" "pae" "mce" "cx8" "apic" "sep" "mtrr" "pge" "mca" "cmov" "pat" "pse36" "clflush" "mmx" "fxsr" "sse" "sse2" "ht" "pni" "pclmul" "monitor" "ssse3" "fma3" "cx16" "sse4_1" "sse4_2" "movbe" "popcnt" "aes" "xsave" "osxsave" "avx" "f16c" "rdrand" "bmi1" "avx2" "bmi2" "rdseed" "adx" "sha_ni" "syscall" "rdtscp" "lm" "lahf_lm" "abm" "constant_tsc". . ConditionOSRelease= "key=value" os-release(5) . ( "=" "!=") ( "VERSION_ID" "<" "<=" "==" "<>" ">=" ">") ("*" "?" "[]") "$=" () "!$=" ( ) . . . ConditionMemoryPressure=, ConditionCPUPressure=, ConditionIOPressure= ( CPU /) . . "%" . "/" : "10%/1min". "10sec" "1min" "5min" . PSI "full" "some" . PSI ( )[5] . slice ":" . slice cgroup . . AssertArchitecture=, AssertVirtualization=, AssertHost=, AssertKernelCommandLine=, AssertKernelVersion=, AssertCredential=, AssertEnvironment=, AssertSecurity=, AssertCapability=, AssertACPower=, AssertNeedsUpdate=, AssertFirstBoot=, AssertPathExists=, AssertPathExistsGlob=, AssertPathIsDirectory=, AssertPathIsSymbolicLink=, AssertPathIsMountPoint=, AssertPathIsReadWrite=, AssertPathIsEncrypted=, AssertDirectoryNotEmpty=, AssertFileNotEmpty=, AssertFileIsExecutable=, AssertUser=, AssertGroup=, AssertControlGroupController=, AssertMemory=, AssertCPUs=, AssertCPUFeature=, AssertOSRelease=, AssertMemoryPressure=, AssertCPUPressure=, AssertIOPressure= ConditionArchitecture= ConditionVirtualization= ... (assertion) . ( ). "failed" ( ) . . . (MAPPING OF UNIT PROPERTIES TO THEIR INVERSES) systemctl show. . <<>> <<>> . . <<>> <<>> +----------------------+---------------------------------------------+---------------------------------------+ | | <<>> | | |<<>> | (Reverse) | | |(Forward) | | | +----------------------+---------------------------------------------+---------------------------------------+ |Before= | After= | [Unit] | +----------------------+---------------------------------------------+ | | |After= | Before= | | | +----------------------+---------------------------------------------+------------------+--------------------+ |Requires= | RequiredBy= | [Unit] | | | | | | [Install] | +----------------------+---------------------------------------------+------------------+--------------------+ |Wants= | WantedBy= | [Unit] | | | | | | [Install] | +----------------------+---------------------------------------------+------------------+--------------------+ |Upholds= | UpheldBy= | [Unit] | | | | | | [Install] | +----------------------+---------------------------------------------+------------------+--------------------+ |PartOf= | ConsistsOf= | [Unit] | | | | | | | | | | | | +----------------------+---------------------------------------------+------------------+--------------------+ |BindsTo= | BoundBy= | [Unit] | | | | | | | | | | | | +----------------------+---------------------------------------------+------------------+--------------------+ |Requisite= | RequisiteOf= | [Unit] | | | | | | | | | | | | +----------------------+---------------------------------------------+------------------+--------------------+ |Conflicts= | ConflictedBy= | [Unit] | | | | | | | | | | | | +----------------------+---------------------------------------------+------------------+--------------------+ |Triggers= | TriggeredBy= | Automatic properties, see notes below | +----------------------+---------------------------------------------+---------------------------------------+ |PropagatesReloadTo= | ReloadPropagatedFrom= | [Unit] | +----------------------+---------------------------------------------+ | | |ReloadPropagatedFrom= | PropagatesReloadTo= | | | +----------------------+---------------------------------------------+------------------+--------------------+ |PropagatesStopTo= | StopPropagatedFrom= | [Unit] | +----------------------+---------------------------------------------+ | | |StopPropagatedFrom= | PropagatesStopTo= | | | +----------------------+---------------------------------------------+------------------+--------------------+ |Following= | / | An automatic | | | | (n/a) | property | | +----------------------+---------------------------------------------+------------------+--------------------+ Note: WantedBy=, RequiredBy=, and UpheldBy= are used in the [Install] to create symlinks in .wants/, .requires/, and .upholds/ directories. They cannot be used directly as a unit configuration setting. Note: ConsistsOf=, BoundBy=, RequisiteOf=, ConflictedBy= are created implicitly along with their reverses and cannot be specified directly. Note: Triggers= is created implicitly between a socket, path unit, or an automount unit, and the unit they activate. By default, a unit with the same name is triggered, but this can be overridden using Sockets=, Service=, and Unit= settings. See systemd.service(5), systemd.socket(5), systemd.path(5), and systemd.automount(5) for details. TriggeredBy= is created implicitly on the triggered unit. Note: Following= is used to group device aliases and points to the "primary" device unit that systemd is using to track device state, usually corresponding to a sysfs path. It does not show up in the "target" unit. [INSTALL] SECTION OPTIONS Unit files may include an [Install], which carries installation information for the unit. This section is not interpreted by systemd(1) during runtime; it is used by the enable and disable commands of the systemctl(1) tool during installation of a unit. Alias= A space-separated list of additional names this unit shall be installed under. The names listed here must have the same suffix (i.e. type) as the unit filename. This option may be specified more than once, in which case all listed names are used. At installation time, systemctl enable will create symlinks from these names to the unit filename. Note that not all unit types support such alias names, and this setting is not supported for them. Specifically, mount, slice, swap, and automount units do not support aliasing. Added in version 201. WantedBy=, RequiredBy=, UpheldBy= This option may be used more than once, or a space-separated list of unit names may be given. A symbolic link is created in the .wants/, .requires/, or .upholds/ directory of each of the listed units when this unit is installed by systemctl enable. This has the effect of a dependency of type Wants=, Requires=, or Upholds= being added from the listed unit to the current unit. See the description of the mentioned dependency types in the [Unit] for details. In case of template units listing non template units, the listing unit must have DefaultInstance= set, or systemctl enable must be called with an instance name. The instance (default or specified) will be added to the .wants/, .requires/, or .upholds/ list of the listed unit. For example, WantedBy=getty.target in a service getty@.service will result in systemctl enable getty@tty2.service creating a getty.target.wants/getty@tty2.service link to getty@.service. This also applies to listing specific instances of templated units: this specific instance will gain the dependency. A template unit may also list a template unit, in which case a generic dependency will be added where each instance of the listing unit will have a dependency on an instance of the listed template with the same instance value. For example, WantedBy=container@.target in a service monitor@.service will result in systemctl enable monitor@.service creating a container@.target.wants/monitor@.service link to monitor@.service, which applies to all instances of container@.target. Added in version 201. Also= Additional units to install/deinstall when this unit is installed/deinstalled. If the user requests installation/deinstallation of a unit with this option configured, systemctl enable and systemctl disable will automatically install/uninstall units listed in this option as well. This option may be used more than once, or a space-separated list of unit names may be given. Added in version 201. DefaultInstance= allbox tab(:); lB lB lB s. T{ "Forward" property T}:T{ "Reverse" property T}:T{ Where used T} l l l s l l ^ ^ l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l s l l l s l l ^ ^ l l l s l l ^ ^ l l l l. T{ Before= T}:T{ After= T}:T{ [Unit] section T} T{ After= T}:T{ Before= T}:: T{ Requires= T}:T{ RequiredBy= T}:T{ [Unit] section T}:T{ [Install] section T} T{ Wants= T}:T{ WantedBy= T}:T{ [Unit] section T}:T{ [Install] section T} T{ Upholds= T}:T{ UpheldBy= T}:T{ [Unit] section T}:T{ [Install] section T} T{ PartOf= T}:T{ ConsistsOf= T}:T{ [Unit] section T}:T{ an automatic property T} T{ BindsTo= T}:T{ BoundBy= T}:T{ [Unit] section T}:T{ an automatic property T} T{ Requisite= T}:T{ RequisiteOf= T}:T{ [Unit] section T}:T{ an automatic property T} T{ Conflicts= T}:T{ ConflictedBy= T}:T{ [Unit] section T}:T{ an automatic property T} T{ Triggers= T}:T{ TriggeredBy= T}:T{ Automatic properties, see notes below T} T{ PropagatesReloadTo= T}:T{ ReloadPropagatedFrom= T}:T{ [Unit] section T} T{ ReloadPropagatedFrom= T}:T{ PropagatesReloadTo= T}:: T{ PropagatesStopTo= T}:T{ StopPropagatedFrom= T}:T{ [Unit] section T} T{ StopPropagatedFrom= T}:T{ PropagatesStopTo= T}:: T{ Following= T}:T{ n/a T}:T{ An automatic property T}:T{ T} Note: WantedBy=, RequiredBy=, and UpheldBy= are used in the [Install] section to create symlinks in .wants/, .requires/, and .upholds/ directories. They cannot be used directly as a unit configuration setting. Note: ConsistsOf=, BoundBy=, RequisiteOf=, ConflictedBy= are created implicitly along with their reverses and cannot be specified directly. Note: Triggers= is created implicitly between a socket, path unit, or an automount unit, and the unit they activate. By default, a unit with the same name is triggered, but this can be overridden using Sockets=, Service=, and Unit= settings. See systemd.service(5), systemd.socket(5), systemd.path(5), and systemd.automount(5) for details. TriggeredBy= is created implicitly on the triggered unit. Note: Following= is used to group device aliases and points to the "primary" device unit that systemd is using to track device state, usually corresponding to a sysfs path. It does not show up in the "target" unit. [INSTALL] SECTION OPTIONS Unit files may include an [Install] section, which carries installation information for the unit. This section is not interpreted by systemd(1) during runtime; it is used by the enable and disable commands of the systemctl(1) tool during installation of a unit. Alias= A space-separated list of additional names this unit shall be installed under. The names listed here must have the same suffix (i.e. type) as the unit filename. This option may be specified more than once, in which case all listed names are used. At installation time, systemctl enable will create symlinks from these names to the unit filename. Note that not all unit types support such alias names, and this setting is not supported for them. Specifically, mount, slice, swap, and automount units do not support aliasing. Added in version 201. WantedBy=, RequiredBy=, UpheldBy= This option may be used more than once, or a space-separated list of unit names may be given. A symbolic link is created in the .wants/, .requires/, or .upholds/ directory of each of the listed units when this unit is installed by systemctl enable. This has the effect of a dependency of type Wants=, Requires=, or Upholds= being added from the listed unit to the current unit. See the description of the mentioned dependency types in the [Unit] section for details. In case of template units listing non template units, the listing unit must have DefaultInstance= set, or systemctl enable must be called with an instance name. The instance (default or specified) will be added to the .wants/, .requires/, or .upholds/ list of the listed unit. For example, WantedBy=getty.target in a service getty@.service will result in systemctl enable getty@tty2.service creating a getty.target.wants/getty@tty2.service link to getty@.service. This also applies to listing specific instances of templated units: this specific instance will gain the dependency. A template unit may also list a template unit, in which case a generic dependency will be added where each instance of the listing unit will have a dependency on an instance of the listed template with the same instance value. For example, WantedBy=container@.target in a service monitor@.service will result in systemctl enable monitor@.service creating a container@.target.wants/monitor@.service link to monitor@.service, which applies to all instances of container@.target. Added in version 201. Also= Additional units to install/deinstall when this unit is installed/deinstalled. If the user requests installation/deinstallation of a unit with this option configured, systemctl enable and systemctl disable will automatically install/uninstall units listed in this option as well. This option may be used more than once, or a space-separated list of unit names may be given. Added in version 201. DefaultInstance= : WantedBy= RequiredBy= UpheldBy= [Install] .wants/ .requires/ .upholds/ . . : ConsistsOf= BoundBy= RequisiteOf= ConflictedBy= . : Triggers= path automount . Sockets= Service= Unit= . systemd.service(5) systemd.socket(5) systemd.path(5) systemd.automount(5) . TriggeredBy= . : Following= <<>> systemd sysfs . <<>> . [INSTALL] ([INSTALL] SECTION OPTIONS) [Install] . systemd(1) enable disable systemctl(1) . Alias= . ( ) . . systemctl enable . . mount slice swap automount . . WantedBy=, RequiredBy=, UpheldBy= . systemctl enable .wants/ .requires/ .upholds/ . Wants= Requires= Upholds= . [Unit] . DefaultInstance= systemctl enable . ( ) .wants/ .requires/ .upholds/ . WantedBy=getty.target getty@.service systemctl enable getty@tty2.service getty.target.wants/getty@tty2.service getty@.service . : . . WantedBy=container@.target monitor@.service systemctl enable monitor@.service container.target.wants/monitor@.service monitor@.service container@.target . . Also= / / . / systemctl enable systemctl disable / . . . DefaultInstance= . . . . Install : %a, %b, %B, %g, %G, %H, %i, %j, %l, %m, %n, %N, %o, %p, %u, %U, %v, %w, %W, %%. . (SPECIFIERS) . . : . +-------------------------------+--------------------------------+--------------------------------------------------------+ | | | | +-------------------------------+--------------------------------+--------------------------------------------------------+ |"%a" | | | | | | | | | | . | | | | x86 x86-64 arm64. | | | | | | | | | | | | | | | | ConditionArchitecture= | | | | . | +-------------------------------+--------------------------------+--------------------------------------------------------+ |"%A" | | | | | | | | | | | | | | IMAGE_VERSION= | | | | /etc/os-release . | | | | | | | | | | | | . | | | | os-release(5) | | | | . | +-------------------------------+--------------------------------+--------------------------------------------------------+ |"%b" | | | | | | | | | (Boot ID) | | | | | . | | | | random(4) | | | | . | +-------------------------------+--------------------------------+--------------------------------------------------------+ |"%B" | | | | | | | | | | | | | | BUILD_ID= | | | | /etc/os-release . | | | | | | | | | | | | . | | | | os-release(5) | | | | . | +-------------------------------+--------------------------------+--------------------------------------------------------+ |"%C" | | /var/cache ( | | | | ) | | | | "$XDG_CACHE_HOME" | | | (Cache) | ( | | | | ). | +-------------------------------+--------------------------------+--------------------------------------------------------+ |"%d" | | | | | | "$CREDENTIALS_DIRECTORY" | | | | . | | | | | | | | "Credentials" systemd.exec(5) | | | | . | +-------------------------------+--------------------------------+--------------------------------------------------------+ |"%D" | | /usr/share/ ( | | | | ) | | | | "$XDG_DATA_HOME" | | | | ( | | | | ). | +-------------------------------+--------------------------------+--------------------------------------------------------+ |"%E" | | /etc/ ( | | | | ) | | | | "$XDG_CONFIG_HOME" | | | | ( | | | | ). | +-------------------------------+--------------------------------+--------------------------------------------------------+ |"%f" | | | | | | ( | | | | ) | | | | / ( | | | | ) | | | | | | | | / | | | | . | | | | | | | | | | | | | | | | | | | | . | +-------------------------------+--------------------------------+--------------------------------------------------------+ |"%g" | | | | | | | | | | . | | | | | | | | "root" . | +-------------------------------+--------------------------------+--------------------------------------------------------+ |"%G" | | GID | | | (GID) | | | | | | | | | . | | | | "0" | | | | . | +-------------------------------+--------------------------------+--------------------------------------------------------+ |"%h" | | | | | | | | | | | | | | . | | | | "/root" | | | | . | | | | | | | | User= | | | | | | | | [Service] | | | | . | +-------------------------------+--------------------------------+--------------------------------------------------------+ |"%H" | | | | | | | | | | | | | | | | | | . | +-------------------------------+--------------------------------+--------------------------------------------------------+ |"%i" | | | | | | | | | | | | | | "@" | | | | . | | | | | | | | . | +-------------------------------+--------------------------------+--------------------------------------------------------+ |"%I" | | "%i" | | | | (unescaped). | +-------------------------------+--------------------------------+--------------------------------------------------------+ |"%j" | | "-" | | | | | | | | . "-" | | | | | | | | "%p" . | +-------------------------------+--------------------------------+--------------------------------------------------------+ |"%J" | | "%j" | | | | . | | | | | | | | | +-------------------------------+--------------------------------+--------------------------------------------------------+ |"%l" | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | . | +-------------------------------+--------------------------------+--------------------------------------------------------+ |"%L" | | /var/log ( | | | | ) | | | | $XDG_STATE_HOME /log | | | | ( | | | | ). | +-------------------------------+--------------------------------+--------------------------------------------------------+ |"%m" | | | | | | | | | | | | | | . | | | | machine-id(5) | | | | . | +-------------------------------+--------------------------------+--------------------------------------------------------+ |"%M" | | | | | | | | | | | | | | IMAGE_ID= | | | | /etc/os-release . | | | | | | | | | | | | . | | | | os-release(5) | | | | . | +-------------------------------+--------------------------------+--------------------------------------------------------+ |"%n" | | | | | | | +-------------------------------+--------------------------------+--------------------------------------------------------+ |"%N" | | "%n" | | | | . | +-------------------------------+--------------------------------+--------------------------------------------------------+ |"%o" | | | | | | | | | | | | | | ID= /etc/os-release | | | | . | | | | os-release(5) | | | | . | +-------------------------------+--------------------------------+--------------------------------------------------------+ |"%p" | | | | | | | | | | | | | | "@" | | | | . | | | | | | | | | | | | "%N" . | +-------------------------------+--------------------------------+--------------------------------------------------------+ |"%P" | | "%p" | | | | . | +-------------------------------+--------------------------------+--------------------------------------------------------+ |"%q" | | | | | | | | | | | | | | | | | | | | | | PRETTY_HOSTNAME= /etc/machine-info | | | | . | | | | | | | | | | | | . | | | | machine-info(5) | | | | . | +-------------------------------+--------------------------------+--------------------------------------------------------+ |"%s" | | | | | | | | | | . | +-------------------------------+--------------------------------+--------------------------------------------------------+ |"%S" | | /var/lib ( | | | | ) | | | | $XDG_STATE_HOME | | | | ( | | | | ). | +-------------------------------+--------------------------------+--------------------------------------------------------+ |"%t" | | /run/ ( | | | | ) | | | | "$XDG_RUNTIME_DIR" | | | | ( | | | | ). | +-------------------------------+--------------------------------+--------------------------------------------------------+ |"%T" | | /tmp | | | | "$TMPDIR" "$TEMP" "$TMP" | | | | . | | | | ( | | | | | | | | | | | | .) | +-------------------------------+--------------------------------+--------------------------------------------------------+ |"%u" | | | | | | | | | | . | | | | | | | | "root" . | | | | | | | | | | | | User= | | | | [Service] | | | | | | | | . | +-------------------------------+--------------------------------+--------------------------------------------------------+ |"%U" | | UID | | | (UID) | | | | | | | | | . | | | | "0" | | | | . | | | | | | | | User= | | | | | | | | [Service] | | | | . | +-------------------------------+--------------------------------+--------------------------------------------------------+ |"%v" | | uname -r. | | | | | | | | | +-------------------------------+--------------------------------+--------------------------------------------------------+ |"%V" | | /var/tmp | | | | "$TMPDIR" "$TEMP" | | | | "$TMP" | | | | . ( | | | | | | | | | | | | .) | +-------------------------------+--------------------------------+--------------------------------------------------------+ |"%w" | | | | | | | | | | | | | | VERSION_ID= | | | | /etc/os-release . | | | | | | | | | | | | . | | | | os-release(5) | | | | . | +-------------------------------+--------------------------------+--------------------------------------------------------+ |"%W" | | (variant) | | | | | | | | | | | | VARIANT_ID= | | | | /etc/os-release . | | | | | | | | | | | | . | | | | os-release(5) | | | | . | +-------------------------------+--------------------------------+--------------------------------------------------------+ |"%y" | | | | | | | | | | . | | | | | | | | | | | | | | | | | | | | | | | | . | | | | | | | | | | | | | | | | . | +-------------------------------+--------------------------------+--------------------------------------------------------+ |"%Y" | | "%y" | | | | . | +-------------------------------+--------------------------------+--------------------------------------------------------+ |"%%" | | "%%" "%" | | | | | | | | | | | | . | +-------------------------------+--------------------------------+--------------------------------------------------------+ (EXAMPLES) . () ( foo.service) systemctl enable : [Unit] Description=Foo [Service] ExecStart=/usr/sbin/foo-daemon [Install] WantedBy=multi-user.target systemctl enable /etc/systemd/system/multi-user.target.wants/foo.service . systemd multi-user.target . systemctl disable . . : /usr/lib/systemd/system /etc/systemd/system . unit.d/ /etc/systemd/system name.conf . . . . . . systemd . . /usr/lib/systemd/system/httpd.service : [Unit] Description=Some HTTP server After=remote-fs.target sqldb.service Requires=sqldb.service AssertPathExists=/srv/webserver [Service] Type=notify ExecStart=/usr/sbin/some-fancy-httpd-server Nice=5 [Install] WantedBy=multi-user.target : /srv/webserver HTTP /srv/www . HTTP (cache) memcached.service (Requires=) (After=). PrivateTmp= ( systemd.exec(5) ). (niceness) . /etc/systemd/system/httpd.service : [Unit] Description=Some HTTP server After=remote-fs.target sqldb.service memcached.service Requires=sqldb.service memcached.service AssertPathExists=/srv/www [Service] Type=notify ExecStart=/usr/sbin/some-fancy-httpd-server Nice=0 PrivateTmp=yes [Install] WantedBy=multi-user.target /etc/systemd/system/httpd.service.d/local.conf : [Unit] After=memcached.service Requires=memcached.service # AssertPathExists= AssertPathExists=/srv/www [Service] Nice=0 PrivateTmp=yes drop-in ( ) AssertPathExists= ( ExecStart= ) . (After= ) drop-in . . . . /etc/systemd/system/service.d/ . . OnFailure= . /etc/systemd/system/failure-handler@.service: [Unit] Description=My failure handler for %i [Service] Type=oneshot # %i . ExecStart=/usr/sbin/myfailurehandler %i failure-handler@.service OnFailure= . /etc/systemd/system/service.d/10-all.conf: [Unit] OnFailure=failure-handler@%N.service systemctl daemon-reload OnFailure= failure-handler@%N.service . . systemd . systemd drop-in /dev/null : mkdir /etc/systemd/system/failure-handler@.service.d/ ln -s /dev/null /etc/systemd/system/failure-handler@.service.d/10-all.conf systemctl daemon-reload failure-handler@.service failure-handler@failure-handler.service . (SEE ALSO) systemd(1), systemctl(1), systemd-system.conf(5), systemd.special(7), systemd.service(5), systemd.socket(5), systemd.device(5), systemd.mount(5), systemd.automount(5), systemd.swap(5), systemd.target(5), systemd.path(5), systemd.timer(5), systemd.scope(5), systemd.slice(5), systemd.time(7), systemd-analyze(1), capabilities(7), systemd.directives(7), uname(1) (NOTES) 1. (Interface Portability and Stability Promise) https://systemd.io/PORTABILITY_AND_STABILITY 2. . /usr/local/ . 3. systemd https://systemd.io/ROOT_STORAGE_DAEMONS 4. https://systemd.io/CREDENTIALS 5. PSI ( ) https://docs.kernel.org/accounting/psi.html systemd 257.13 SYSTEMD.UNIT(5)