]> git.proxmox.com Git - systemd.git/blob - man/systemd.unit.5
Imported Upstream version 208
[systemd.git] / man / systemd.unit.5
1 '\" t
2 .TH "SYSTEMD\&.UNIT" "5" "" "systemd 208" "systemd.unit"
3 .\" -----------------------------------------------------------------
4 .\" * Define some portability stuff
5 .\" -----------------------------------------------------------------
6 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7 .\" http://bugs.debian.org/507673
8 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
9 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10 .ie \n(.g .ds Aq \(aq
11 .el .ds Aq '
12 .\" -----------------------------------------------------------------
13 .\" * set default formatting
14 .\" -----------------------------------------------------------------
15 .\" disable hyphenation
16 .nh
17 .\" disable justification (adjust text to left margin only)
18 .ad l
19 .\" -----------------------------------------------------------------
20 .\" * MAIN CONTENT STARTS HERE *
21 .\" -----------------------------------------------------------------
22 .SH "NAME"
23 systemd.unit \- Unit configuration
24 .SH "SYNOPSIS"
25 .PP
26 \fIservice\fR\&.service,
27 \fIsocket\fR\&.socket,
28 \fIdevice\fR\&.device,
29 \fImount\fR\&.mount,
30 \fIautomount\fR\&.automount,
31 \fIswap\fR\&.swap,
32 \fItarget\fR\&.target,
33 \fIpath\fR\&.path,
34 \fItimer\fR\&.timer,
35 \fIsnapshot\fR\&.snapshot,
36 \fIslice\fR\&.slice,
37 \fIscope\fR\&.scope
38 .PP
39 .nf
40 /etc/systemd/system/*
41 /run/systemd/system/*
42 /usr/lib/systemd/system/*
43 \&.\&.\&.
44
45 .fi
46 .PP
47 .nf
48 $HOME/\&.config/systemd/user/*
49 /etc/systemd/user/*
50 /run/systemd/user/*
51 /usr/lib/systemd/user/*
52 \&.\&.\&.
53
54 .fi
55 .SH "DESCRIPTION"
56 .PP
57 A unit configuration file encodes information about a service, a socket, a device, a mount point, an automount point, a swap file or partition, a start\-up target, a watched file system path, a timer controlled and supervised by
58 \fBsystemd\fR(1), a temporary system state snapshot, a resource management slice or a group of externally created processes\&. The syntax is inspired by
59 \m[blue]\fBXDG Desktop Entry Specification\fR\m[]\&\s-2\u[1]\d\s+2\&.desktop
60 files, which are in turn inspired by Microsoft Windows
61 \&.ini
62 files\&.
63 .PP
64 This man page lists the common configuration options of all the unit types\&. These options need to be configured in the [Unit] or [Install] sections of the unit files\&.
65 .PP
66 In addition to the generic [Unit] and [Install] sections described here, each unit may have a type\-specific section, e\&.g\&. [Service] for a service unit\&. See the respective man pages for more information:
67 \fBsystemd.service\fR(5),
68 \fBsystemd.socket\fR(5),
69 \fBsystemd.device\fR(5),
70 \fBsystemd.mount\fR(5),
71 \fBsystemd.automount\fR(5),
72 \fBsystemd.swap\fR(5),
73 \fBsystemd.target\fR(5),
74 \fBsystemd.path\fR(5),
75 \fBsystemd.timer\fR(5),
76 \fBsystemd.snapshot\fR(5)\&.
77 \fBsystemd.slice\fR(5)\&.
78 \fBsystemd.scope\fR(5)\&.
79 .PP
80 Unit files are loaded from a set of paths determined during compilation, described in the next section\&.
81 .PP
82 Unit files may contain additional options on top of those listed here\&. If systemd encounters an unknown option, it will write a warning log message but continue loading the unit\&. If an option is prefixed with
83 \fBX\-\fR, it is ignored completely by systemd\&. Applications may use this to include additional information in the unit files\&.
84 .PP
85 Boolean arguments used in unit files can be written in various formats\&. For positive settings the strings
86 \fB1\fR,
87 \fByes\fR,
88 \fBtrue\fR
89 and
90 \fBon\fR
91 are equivalent\&. For negative settings, the strings
92 \fB0\fR,
93 \fBno\fR,
94 \fBfalse\fR
95 and
96 \fBoff\fR
97 are equivalent\&.
98 .PP
99 Time span values encoded in unit files can be written in various formats\&. A stand\-alone number specifies a time in seconds\&. If suffixed with a time unit, the unit is honored\&. A concatenation of multiple values with units is supported, in which case the values are added up\&. Example: "50" refers to 50 seconds; "2min 200ms" refers to 2 minutes plus 200 milliseconds, i\&.e\&. 120200ms\&. The following time units are understood: s, min, h, d, w, ms, us\&. For details see
100 \fBsystemd.time\fR(7)\&.
101 .PP
102 Empty lines and lines starting with # or ; are ignored\&. This may be used for commenting\&. Lines ending in a backslash are concatenated with the following line while reading and the backslash is replaced by a space character\&. This may be used to wrap long lines\&.
103 .PP
104 Along with a unit file
105 foo\&.service, the directory
106 foo\&.service\&.wants/
107 may exist\&. All unit files symlinked from such a directory are implicitly added as dependencies of type
108 \fIWanted=\fR
109 to the unit\&. This is useful to hook units into the start\-up of other units, without having to modify their unit files\&. For details about the semantics of
110 \fIWanted=\fR, see below\&. The preferred way to create symlinks in the
111 \&.wants/
112 directory of a unit file is with the
113 \fBenable\fR
114 command of the
115 \fBsystemctl\fR(1)
116 tool which reads information from the [Install] section of unit files (see below)\&. A similar functionality exists for
117 \fIRequires=\fR
118 type dependencies as well, the directory suffix is
119 \&.requires/
120 in this case\&.
121 .PP
122 Along with a unit file
123 foo\&.service, a directory
124 foo\&.service\&.d/
125 may exist\&. All files with the suffix
126 "\&.conf"
127 from this directory will be parsed after the file itself is parsed\&. This is useful to alter or add configuration settings to a unit, without having to modify their unit files\&. Make sure that the file that is included has the appropriate section headers before any directive\&.
128 .PP
129 If a line starts with
130 \fB\&.include\fR
131 followed by a filename, the specified file will be parsed at this point\&. Make sure that the file that is included has the appropriate section headers before any directives\&.
132 .PP
133 Note that while systemd offers a flexible dependency system between units it is recommended to use this functionality only sparingly and instead rely on techniques such as bus\-based or socket\-based activation which make dependencies implicit, resulting in a both simpler and more flexible system\&.
134 .PP
135 Some unit names reflect paths existing in the file system namespace\&. Example: a device unit
136 dev\-sda\&.device
137 refers to a device with the device node
138 /dev/sda
139 in the file system namespace\&. If this applies, a special way to escape the path name is used, so that the result is usable as part of a filename\&. Basically, given a path, "/" is replaced by "\-", and all unprintable characters and the "\-" are replaced by C\-style "\ex20" escapes\&. The root directory "/" is encoded as single dash, while otherwise the initial and ending "/" is removed from all paths during transformation\&. This escaping is reversible\&.
140 .PP
141 Optionally, units may be instantiated from a template file at runtime\&. This allows creation of multiple units from a single configuration file\&. If systemd looks for a unit configuration file, it will first search for the literal unit name in the filesystem\&. If that yields no success and the unit name contains an
142 "@"
143 character, systemd will look for a unit template that shares the same name but with the instance string (i\&.e\&. the part between the
144 "@"
145 character and the suffix) removed\&. Example: if a service
146 getty@tty3\&.service
147 is requested and no file by that name is found, systemd will look for
148 getty@\&.service
149 and instantiate a service from that configuration file if it is found\&.
150 .PP
151 To refer to the instance string from within the configuration file you may use the special
152 "%i"
153 specifier in many of the configuration options\&. See below for details\&.
154 .PP
155 If a unit file is empty (i\&.e\&. has the file size 0) or is symlinked to
156 /dev/null, its configuration will not be loaded and it appears with a load state of
157 "masked", and cannot be activated\&. Use this as an effective way to fully disable a unit, making it impossible to start it even manually\&.
158 .PP
159 The unit file format is covered by the
160 \m[blue]\fBInterface Stability Promise\fR\m[]\&\s-2\u[2]\d\s+2\&.
161 .SH "UNIT LOAD PATH"
162 .PP
163 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\&.
164 .PP
165 When systemd is running in user mode (\fB\-\-user\fR) and the variable
166 \fI$SYSTEMD_UNIT_PATH\fR
167 is set, this contents of this variable overrides the unit load path\&.
168 .sp
169 .it 1 an-trap
170 .nr an-no-space-flag 1
171 .nr an-break-flag 1
172 .br
173 .B Table\ \&1.\ \& Load path when running in system mode (\-\-system).
174 .TS
175 allbox tab(:);
176 lB lB.
177 T{
178 Path
179 T}:T{
180 Description
181 T}
182 .T&
183 l l
184 l l
185 l l.
186 T{
187 /etc/systemd/system
188 T}:T{
189 Local configuration
190 T}
191 T{
192 /run/systemd/system
193 T}:T{
194 Runtime units
195 T}
196 T{
197 /usr/lib/systemd/system
198 T}:T{
199 Units of installed packages
200 T}
201 .TE
202 .sp 1
203 .sp
204 .it 1 an-trap
205 .nr an-no-space-flag 1
206 .nr an-break-flag 1
207 .br
208 .B Table\ \&2.\ \& Load path when running in user mode (\-\-user).
209 .TS
210 allbox tab(:);
211 lB lB.
212 T{
213 Path
214 T}:T{
215 Description
216 T}
217 .T&
218 l l
219 l l
220 l l
221 l l.
222 T{
223 $HOME/\&.config/systemd/user
224 T}:T{
225 User configuration
226 T}
227 T{
228 /etc/systemd/user
229 T}:T{
230 Local configuration
231 T}
232 T{
233 /run/systemd/user
234 T}:T{
235 Runtime units
236 T}
237 T{
238 /usr/lib/systemd/user
239 T}:T{
240 Units of installed packages
241 T}
242 .TE
243 .sp 1
244 .PP
245 Additional units might be loaded into systemd ("linked") from directories not on the unit load path\&. See the
246 \fBlink\fR
247 command for
248 \fBsystemctl\fR(1)\&. Also, some units are dynamically created via generators
249 \m[blue]\fBGenerators\fR\m[]\&\s-2\u[3]\d\s+2\&.
250 .SH "OPTIONS"
251 .PP
252 Unit file may include a [Unit] section, which carries generic information about the unit that is not dependent on the type of unit:
253 .PP
254 \fIDescription=\fR
255 .RS 4
256 A free\-form string describing the unit\&. This is intended for use in UIs to show descriptive information along with the unit name\&. The description should contain a name that means something to the end user\&.
257 "Apache2 Web Server"
258 is a good example\&. Bad examples are
259 "high\-performance light\-weight HTTP server"
260 (too generic) or
261 "Apache2"
262 (too specific and meaningless for people who do not know Apache)\&.
263 .RE
264 .PP
265 \fIDocumentation=\fR
266 .RS 4
267 A space\-separated list of URIs referencing documentation for this unit or its configuration\&. Accepted are only URIs of the types
268 "http://",
269 "https://",
270 "file:",
271 "info:",
272 "man:"\&. For more information about the syntax of these URIs, see
273 \fBuri\fR(7)\&. The URIs should be listed in order of relevance, starting with the most relevant\&. It is a good idea to first reference documentation that explains what the unit\*(Aqs purpose is, followed by how it is configured, followed by any other related documentation\&. This option may be specified more than once in which case the specified list of URIs is merged\&. If the empty string is assigned to this option, the list is reset and all prior assignments will have no effect\&.
274 .RE
275 .PP
276 \fIRequires=\fR
277 .RS 4
278 Configures requirement dependencies on other units\&. If this unit gets activated, the units listed here will be activated as well\&. If one of the other units gets deactivated or its activation fails, this unit will be deactivated\&. This option may be specified more than once, in which case requirement dependencies for all listed names are created\&. Note that requirement dependencies do not influence the order in which services are started or stopped\&. This has to be configured independently with the
279 \fIAfter=\fR
280 or
281 \fIBefore=\fR
282 options\&. If a unit
283 foo\&.service
284 requires a unit
285 bar\&.service
286 as configured with
287 \fIRequires=\fR
288 and no ordering is configured with
289 \fIAfter=\fR
290 or
291 \fIBefore=\fR, then both units will be started simultaneously and without any delay between them if
292 foo\&.service
293 is activated\&. Often it is a better choice to use
294 \fIWants=\fR
295 instead of
296 \fIRequires=\fR
297 in order to achieve a system that is more robust when dealing with failing services\&.
298 .sp
299 Note that dependencies of this type may also be configured outside of the unit configuration file by adding a symlink to a
300 \&.requires/
301 directory accompanying the unit file\&. For details see above\&.
302 .RE
303 .PP
304 \fIRequiresOverridable=\fR
305 .RS 4
306 Similar to
307 \fIRequires=\fR\&. Dependencies listed in
308 \fIRequiresOverridable=\fR
309 which cannot be fulfilled or fail to start are ignored if the startup was explicitly requested by the user\&. If the start\-up was pulled in indirectly by some dependency or automatic start\-up of units that is not requested by the user, this dependency must be fulfilled and otherwise the transaction fails\&. Hence, this option may be used to configure dependencies that are normally honored unless the user explicitly starts up the unit, in which case whether they failed or not is irrelevant\&.
310 .RE
311 .PP
312 \fIRequisite=\fR, \fIRequisiteOverridable=\fR
313 .RS 4
314 Similar to
315 \fIRequires=\fR
316 and
317 \fIRequiresOverridable=\fR, respectively\&. However, if a unit listed here is not started already it will not be started and the transaction fails immediately\&.
318 .RE
319 .PP
320 \fIWants=\fR
321 .RS 4
322 A weaker version of
323 \fIRequires=\fR\&. A unit listed in this option will be started if the configuring unit is\&. However, if the listed unit fails to start up or cannot be added to the transaction this has no impact on the validity of the transaction as a whole\&. This is the recommended way to hook start\-up of one unit to the start\-up of another unit\&.
324 .sp
325 Note that dependencies of this type may also be configured outside of the unit configuration file by adding a symlink to a
326 \&.wants/
327 directory accompanying the unit file\&. For details see above\&.
328 .RE
329 .PP
330 \fIBindsTo=\fR
331 .RS 4
332 Configures requirement dependencies, very similar in style to
333 \fIRequires=\fR, however in addition to this behavior it also declares that this unit is stopped when any of the units listed suddenly disappears\&. Units can suddenly, unexpectedly disappear if a service terminates on its own choice, a device is unplugged or a mount point unmounted without involvement of systemd\&.
334 .RE
335 .PP
336 \fIPartOf=\fR
337 .RS 4
338 Configures dependencies similar to
339 \fIRequires=\fR, but limited to stopping and restarting of units\&. When systemd stops or restarts the units listed here, the action is propagated to this unit\&. Note that this is a one way dependency \- changes to this unit do not affect the listed units\&.
340 .RE
341 .PP
342 \fIConflicts=\fR
343 .RS 4
344 Configures negative requirement dependencies\&. If a unit has a
345 \fIConflicts=\fR
346 setting on another unit, starting the former will stop the latter and vice versa\&. Note that this setting is independent of and orthogonal to the
347 \fIAfter=\fR
348 and
349 \fIBefore=\fR
350 ordering dependencies\&.
351 .sp
352 If a unit A that conflicts with a unit B is scheduled to be started at the same time as B, the transaction will either fail (in case both are required part of the transaction) or be modified to be fixed (in case one or both jobs are not a required part of the transaction)\&. In the latter case the job that is not the required will be removed, or in case both are not required the unit that conflicts will be started and the unit that is conflicted is stopped\&.
353 .RE
354 .PP
355 \fIBefore=\fR, \fIAfter=\fR
356 .RS 4
357 Configures ordering dependencies between units\&. If a unit
358 foo\&.service
359 contains a setting
360 \fBBefore=bar\&.service\fR
361 and both units are being started,
362 bar\&.service\*(Aqs start\-up is delayed until
363 foo\&.service
364 is started up\&. Note that this setting is independent of and orthogonal to the requirement dependencies as configured by
365 \fIRequires=\fR\&. It is a common pattern to include a unit name in both the
366 \fIAfter=\fR
367 and
368 \fIRequires=\fR
369 option in which case the unit listed will be started before the unit that is configured with these options\&. This option may be specified more than once, in which case ordering dependencies for all listed names are created\&.
370 \fIAfter=\fR
371 is the inverse of
372 \fIBefore=\fR, i\&.e\&. while
373 \fIAfter=\fR
374 ensures that the configured unit is started after the listed unit finished starting up,
375 \fIBefore=\fR
376 ensures the opposite, i\&.e\&. that the configured unit is fully started up before the listed unit is started\&. Note that when two units with an ordering dependency between them are shut down, the inverse of the start\-up order is applied\&. i\&.e\&. if a unit is configured with
377 \fIAfter=\fR
378 on another unit, the former is stopped before the latter if both are shut down\&. If one unit with an ordering dependency on another unit is shut down while the latter is started up, the shut down is ordered before the start\-up regardless whether the ordering dependency is actually of type
379 \fIAfter=\fR
380 or
381 \fIBefore=\fR\&. If two units have no ordering dependencies between them, they are shut down or started up simultaneously, and no ordering takes place\&.
382 .RE
383 .PP
384 \fIOnFailure=\fR
385 .RS 4
386 Lists one or more units that are activated when this unit enters the
387 "failed"
388 state\&.
389 .RE
390 .PP
391 \fIPropagatesReloadTo=\fR, \fIReloadPropagatedFrom=\fR
392 .RS 4
393 Lists one or more units where reload requests on the unit will be propagated to/on the other unit will be propagated from\&. Issuing a reload request on a unit will automatically also enqueue a reload request on all units that the reload request shall be propagated to via these two settings\&.
394 .RE
395 .PP
396 \fIRequiresMountsFor=\fR
397 .RS 4
398 Takes a space\-separated list of absolute paths\&. Automatically adds dependencies of type
399 \fIRequires=\fR
400 and
401 \fIAfter=\fR
402 for all mount units required to access the specified path\&.
403 .RE
404 .PP
405 \fIOnFailureIsolate=\fR
406 .RS 4
407 Takes a boolean argument\&. If
408 \fBtrue\fR, the unit listed in
409 \fIOnFailure=\fR
410 will be enqueued in isolation mode, i\&.e\&. all units that are not its dependency will be stopped\&. If this is set, only a single unit may be listed in
411 \fIOnFailure=\fR\&. Defaults to
412 \fBfalse\fR\&.
413 .RE
414 .PP
415 \fIIgnoreOnIsolate=\fR
416 .RS 4
417 Takes a boolean argument\&. If
418 \fBtrue\fR, this unit will not be stopped when isolating another unit\&. Defaults to
419 \fBfalse\fR\&.
420 .RE
421 .PP
422 \fIIgnoreOnSnapshot=\fR
423 .RS 4
424 Takes a boolean argument\&. If
425 \fBtrue\fR, this unit will not be included in snapshots\&. Defaults to
426 \fBtrue\fR
427 for device and snapshot units,
428 \fBfalse\fR
429 for the others\&.
430 .RE
431 .PP
432 \fIStopWhenUnneeded=\fR
433 .RS 4
434 Takes a boolean argument\&. If
435 \fBtrue\fR, this unit will be stopped when it is no longer used\&. Note that in order to minimize the work to be executed, systemd will not stop units by default unless they are conflicting with other units, or the user explicitly requested their shut down\&. If this option is set, a unit will be automatically cleaned up if no other active unit requires it\&. Defaults to
436 \fBfalse\fR\&.
437 .RE
438 .PP
439 \fIRefuseManualStart=\fR, \fIRefuseManualStop=\fR
440 .RS 4
441 Takes a boolean argument\&. If
442 \fBtrue\fR, this unit can only be activated or deactivated indirectly\&. In this case, explicit start\-up or termination requested by the user is denied, however if it is started or stopped as a dependency of another unit, start\-up or termination will succeed\&. This is mostly a safety feature to ensure that the user does not accidentally activate units that are not intended to be activated explicitly, and not accidentally deactivate units that are not intended to be deactivated\&. These options default to
443 \fBfalse\fR\&.
444 .RE
445 .PP
446 \fIAllowIsolate=\fR
447 .RS 4
448 Takes a boolean argument\&. If
449 \fBtrue\fR, this unit may be used with the
450 \fBsystemctl isolate\fR
451 command\&. Otherwise, this will be refused\&. It probably is a good idea to leave this disabled except for target units that shall be used similar to runlevels in SysV init systems, just as a precaution to avoid unusable system states\&. This option defaults to
452 \fBfalse\fR\&.
453 .RE
454 .PP
455 \fIDefaultDependencies=\fR
456 .RS 4
457 Takes a boolean argument\&. If
458 \fBtrue\fR, (the default), a few default dependencies will implicitly be created for the unit\&. The actual dependencies created depend on the unit type\&. For example, for service units, these dependencies ensure that the service is started only after basic system initialization is completed and is properly terminated on system shutdown\&. See the respective man pages for details\&. Generally, only services involved with early boot or late shutdown should set this option to
459 \fBfalse\fR\&. It is highly recommended to leave this option enabled for the majority of common units\&. If set to
460 \fBfalse\fR, this option does not disable all implicit dependencies, just non\-essential ones\&.
461 .RE
462 .PP
463 \fIJobTimeoutSec=\fR
464 .RS 4
465 When clients are waiting for a job of this unit to complete, time out after the specified time\&. If this time limit is reached, the job will be cancelled, the unit however will not change state or even enter the
466 "failed"
467 mode\&. This value defaults to 0 (job timeouts disabled), except for device units\&. NB: this timeout is independent from any unit\-specific timeout (for example, the timeout set with
468 \fITimeout=\fR
469 in service units) as the job timeout has no effect on the unit itself, only on the job that might be pending for it\&. Or in other words: unit\-specific timeouts are useful to abort unit state changes, and revert them\&. The job timeout set with this option however is useful to abort only the job waiting for the unit state to change\&.
470 .RE
471 .PP
472 \fIConditionPathExists=\fR, \fIConditionPathExistsGlob=\fR, \fIConditionPathIsDirectory=\fR, \fIConditionPathIsSymbolicLink=\fR, \fIConditionPathIsMountPoint=\fR, \fIConditionPathIsReadWrite=\fR, \fIConditionDirectoryNotEmpty=\fR, \fIConditionFileNotEmpty=\fR, \fIConditionFileIsExecutable=\fR, \fIConditionKernelCommandLine=\fR, \fIConditionVirtualization=\fR, \fIConditionSecurity=\fR, \fIConditionCapability=\fR, \fIConditionHost=\fR, \fIConditionACPower=\fR, \fIConditionNull=\fR
473 .RS 4
474 Before starting a unit verify that the specified condition is true\&. If it is not true, the starting of the unit will be skipped, however all ordering dependencies of it are still respected\&. A failing condition will not result in the unit being moved into a failure state\&. The condition is checked at the time the queued start job is to be executed\&.
475 .sp
476 With
477 \fIConditionPathExists=\fR
478 a file existence condition is checked before a unit is started\&. If the specified absolute path name does not exist, the condition will fail\&. If the absolute path name passed to
479 \fIConditionPathExists=\fR
480 is prefixed with an exclamation mark ("!"), the test is negated, and the unit is only started if the path does not exist\&.
481 .sp
482 \fIConditionPathExistsGlob=\fR
483 is similar to
484 \fIConditionPathExists=\fR, but checks for the existence of at least one file or directory matching the specified globbing pattern\&.
485 .sp
486 \fIConditionPathIsDirectory=\fR
487 is similar to
488 \fIConditionPathExists=\fR
489 but verifies whether a certain path exists and is a directory\&.
490 .sp
491 \fIConditionPathIsSymbolicLink=\fR
492 is similar to
493 \fIConditionPathExists=\fR
494 but verifies whether a certain path exists and is a symbolic link\&.
495 .sp
496 \fIConditionPathIsMountPoint=\fR
497 is similar to
498 \fIConditionPathExists=\fR
499 but verifies whether a certain path exists and is a mount point\&.
500 .sp
501 \fIConditionPathIsReadWrite=\fR
502 is similar to
503 \fIConditionPathExists=\fR
504 but verifies whether the underlying file system is readable and writable (i\&.e\&. not mounted read\-only)\&.
505 .sp
506 \fIConditionDirectoryNotEmpty=\fR
507 is similar to
508 \fIConditionPathExists=\fR
509 but verifies whether a certain path exists and is a non\-empty directory\&.
510 .sp
511 \fIConditionFileNotEmpty=\fR
512 is similar to
513 \fIConditionPathExists=\fR
514 but verifies whether a certain path exists and refers to a regular file with a non\-zero size\&.
515 .sp
516 \fIConditionFileIsExecutable=\fR
517 is similar to
518 \fIConditionPathExists=\fR
519 but verifies whether a certain path exists, is a regular file and marked executable\&.
520 .sp
521 Similar,
522 \fIConditionKernelCommandLine=\fR
523 may be used to check whether a specific kernel command line option is set (or if prefixed with the exclamation mark unset)\&. The argument must either be a single word, or an assignment (i\&.e\&. two words, separated
524 "=")\&. In the former case the kernel command line is searched for the word appearing as is, or as left hand side of an assignment\&. In the latter case the exact assignment is looked for with right and left hand side matching\&.
525 .sp
526 \fIConditionVirtualization=\fR
527 may be used to check whether the system is executed in a virtualized environment and optionally test whether it is a specific implementation\&. Takes either boolean value to check if being executed in any virtualized environment, or one of
528 \fIvm\fR
529 and
530 \fIcontainer\fR
531 to test against a generic type of virtualization solution, or one of
532 \fIqemu\fR,
533 \fIkvm\fR,
534 \fIvmware\fR,
535 \fImicrosoft\fR,
536 \fIoracle\fR,
537 \fIxen\fR,
538 \fIbochs\fR,
539 \fIchroot\fR,
540 \fIuml\fR,
541 \fIopenvz\fR,
542 \fIlxc\fR,
543 \fIlxc\-libvirt\fR,
544 \fIsystemd\-nspawn\fR
545 to test against a specific implementation\&. If multiple virtualization technologies are nested, only the innermost is considered\&. The test may be negated by prepending an exclamation mark\&.
546 .sp
547 \fIConditionSecurity=\fR
548 may be used to check whether the given security module is enabled on the system\&. Currently the recognized values values are
549 \fIselinux\fR,
550 \fIapparmor\fR,
551 \fIima\fR
552 and
553 \fIsmack\fR\&. The test may be negated by prepending an exclamation mark\&.
554 .sp
555 \fIConditionCapability=\fR
556 may be used to check whether the given capability exists in the capability bounding set of the service manager (i\&.e\&. this does not check whether capability is actually available in the permitted or effective sets, see
557 \fBcapabilities\fR(7)
558 for details)\&. Pass a capability name such as
559 "CAP_MKNOD", possibly prefixed with an exclamation mark to negate the check\&.
560 .sp
561 \fIConditionHost=\fR
562 may be used to match against the hostname or machine ID of the host\&. This either takes a hostname string (optionally with shell style globs) which is tested against the locally set hostname as returned by
563 \fBgethostname\fR(2), or a machine ID formatted as string (see
564 \fBmachine-id\fR(5))\&. The test may be negated by prepending an exclamation mark\&.
565 .sp
566 \fIConditionACPower=\fR
567 may be used to check whether the system has AC power, or is exclusively battery powered at the time of activation of the unit\&. This takes a boolean argument\&. If set to
568 \fItrue\fR, the condition will hold only if at least one AC connector of the system is connected to a power source, or if no AC connectors are known\&. Conversely, if set to
569 \fIfalse\fR, the condition will hold only if there is at least one AC connector known and all AC connectors are disconnected from a power source\&.
570 .sp
571 Finally,
572 \fIConditionNull=\fR
573 may be used to add a constant condition check value to the unit\&. It takes a boolean argument\&. If set to
574 \fIfalse\fR, the condition will always fail, otherwise succeed\&.
575 .sp
576 If multiple conditions are specified, the unit will be executed if all of them apply (i\&.e\&. a logical AND is applied)\&. Condition checks can be prefixed with a pipe symbol (|) in which case a condition becomes a triggering condition\&. If at least one triggering condition is defined for a unit, then the unit will be executed if at least one of the triggering conditions apply and all of the non\-triggering conditions\&. If you prefix an argument with the pipe symbol and an exclamation mark, the pipe symbol must be passed first, the exclamation second\&. Except for
577 \fIConditionPathIsSymbolicLink=\fR, all path checks follow symlinks\&. If any of these options is assigned the empty string, the list of conditions is reset completely, all previous condition settings (of any kind) will have no effect\&.
578 .RE
579 .PP
580 \fISourcePath=\fR
581 .RS 4
582 A path to a configuration file this unit has been generated from\&. This is primarily useful for implementation of generator tools that convert configuration from an external configuration file format into native unit files\&. Thus functionality should not be used in normal units\&.
583 .RE
584 .PP
585 Unit file may include a [Install] section, which carries installation information for the unit\&. This section is not interpreted by
586 \fBsystemd\fR(1)
587 during runtime\&. It is used exclusively by the
588 \fBenable\fR
589 and
590 \fBdisable\fR
591 commands of the
592 \fBsystemctl\fR(1)
593 tool during installation of a unit:
594 .PP
595 \fIAlias=\fR
596 .RS 4
597 Additional names this unit shall be installed under\&. The names listed here must have the same suffix (i\&.e\&. type) as the unit file name\&. This option may be specified more than once, in which case all listed names are used\&. At installation time,
598 \fBsystemctl enable\fR
599 will create symlinks from these names to the unit filename\&.
600 .RE
601 .PP
602 \fIWantedBy=\fR, \fIRequiredBy=\fR
603 .RS 4
604 A symbolic link is created in the
605 \&.wants/
606 or
607 \&.requires/
608 directory of the listed unit when this unit is activated by
609 \fBsystemctl enable\fR\&. This has the effect that a dependency of type
610 \fIWants=\fR
611 or
612 \fIRequires=\fR
613 is added from the listed unit to the current unit\&. The primary result is that the current unit will be started when the listed unit is started\&. See the description of
614 \fIWants=\fR
615 and
616 \fIRequires=\fR
617 in the [Unit] section for details\&.
618 .sp
619 \fBWantedBy=foo\&.service\fR
620 in a service
621 bar\&.service
622 is mostly equivalent to
623 \fBAlias=foo\&.service\&.wants/bar\&.service\fR
624 in the same file\&. In case of template units,
625 \fBsystemctl enable\fR
626 must be called with an instance name, and this instance will be added to the
627 \&.wants/
628 or
629 \&.requires/
630 list of the listed unit\&. E\&.g\&.
631 \fBWantedBy=getty\&.target\fR
632 in a service
633 getty@\&.service
634 will result in
635 \fBsystemctl enable getty@tty2\&.service\fR
636 creating a
637 getty\&.target\&.wants/getty@tty2\&.service
638 link to
639 getty@\&.service\&.
640 .RE
641 .PP
642 \fIAlso=\fR
643 .RS 4
644 Additional units to install/deinstall when this unit is installed/deinstalled\&. If the user requests installation/deinstallation of a unit with this option configured,
645 \fBsystemctl enable\fR
646 and
647 \fBsystemctl disable\fR
648 will automatically install/uninstall units listed in this option as well\&.
649 .RE
650 .PP
651 The following specifiers are interpreted in the Install section: %n, %N, %p, %i, %U, %u, %m, %H, %b, %v\&. For their meaning see the next section\&.
652 .SH "SPECIFIERS"
653 .PP
654 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\&. The following specifiers are understood:
655 .sp
656 .it 1 an-trap
657 .nr an-no-space-flag 1
658 .nr an-break-flag 1
659 .br
660 .B Table\ \&3.\ \&Specifiers available in unit files
661 .TS
662 allbox tab(:);
663 lB lB lB.
664 T{
665 Specifier
666 T}:T{
667 Meaning
668 T}:T{
669 Details
670 T}
671 .T&
672 l l l
673 l l l
674 l l l
675 l l l
676 l l l
677 l l l
678 l l l
679 l l l
680 l l l
681 l l l
682 l l l
683 l l l
684 l l l
685 l l l
686 l l l
687 l l l
688 l l l
689 l l l
690 l l l
691 l l l.
692 T{
693 "%n"
694 T}:T{
695 Full unit name
696 T}:T{
697 \ \&
698 T}
699 T{
700 "%N"
701 T}:T{
702 Unescaped full unit name
703 T}:T{
704 \ \&
705 T}
706 T{
707 "%p"
708 T}:T{
709 Prefix name
710 T}:T{
711 For instantiated units this refers to the string before the @\&. For non\-instantiated units this refers to to the name of the unit with the type suffix removed\&.
712 T}
713 T{
714 "%P"
715 T}:T{
716 Unescaped prefix name
717 T}:T{
718 \ \&
719 T}
720 T{
721 "%i"
722 T}:T{
723 Instance name
724 T}:T{
725 For instantiated units: this is the string between the "@" character and the suffix\&.
726 T}
727 T{
728 "%I"
729 T}:T{
730 Unescaped instance name
731 T}:T{
732 \ \&
733 T}
734 T{
735 "%f"
736 T}:T{
737 Unescaped filename
738 T}:T{
739 This is either the unescaped instance name (if applicable) with / prepended (if applicable), or the prefix name similarly prepended with /\&.
740 T}
741 T{
742 "%c"
743 T}:T{
744 Control group path of the unit
745 T}:T{
746 \ \&
747 T}
748 T{
749 "%r"
750 T}:T{
751 Root control group path where units are placed\&.
752 T}:T{
753 For system instances this usually resolves to /system, except in containers, where the path might be prefixed with the container\*(Aqs root control group\&.
754 T}
755 T{
756 "%R"
757 T}:T{
758 Parent directory of the control group path where units are placed\&.
759 T}:T{
760 For system instances this usually
761 resolves to /, except in
762 containers, where this resolves to the
763 container\*(Aqs root directory\&.
764 T}
765 T{
766 "%t"
767 T}:T{
768 Runtime socket dir
769 T}:T{
770 This is either /run (for the system manager) or "$XDG_RUNTIME_DIR" (for user managers)\&.
771 T}
772 T{
773 "%u"
774 T}:T{
775 User name
776 T}:T{
777 This is the name of the configured user of the unit, or (if none is set) the user running the systemd instance\&.
778 T}
779 T{
780 "%U"
781 T}:T{
782 User UID
783 T}:T{
784 This is the UID of the configured user of the unit, or (if none is set) the user running the systemd instance\&.
785 T}
786 T{
787 "%h"
788 T}:T{
789 User home directory
790 T}:T{
791 This is the home directory of the configured user of the unit, or (if none is set) the user running the systemd instance\&.
792 T}
793 T{
794 "%s"
795 T}:T{
796 User shell
797 T}:T{
798 This is the shell of the configured user of the unit, or (if none is set) the user running the systemd instance\&. If the user is "root" (UID equal to 0), the shell configured in account database is ignored and /bin/sh is always used\&.
799 T}
800 T{
801 "%m"
802 T}:T{
803 Machine ID
804 T}:T{
805 The machine ID of the running system, formatted as string\&. See \fBmachine-id\fR(5) for more information\&.
806 T}
807 T{
808 "%b"
809 T}:T{
810 Boot ID
811 T}:T{
812 The boot ID of the running system, formatted as string\&. See \fBrandom\fR(4) for more information\&.
813 T}
814 T{
815 "%H"
816 T}:T{
817 Host name
818 T}:T{
819 The hostname of the running system\&.
820 T}
821 T{
822 "%v"
823 T}:T{
824 Kernel release
825 T}:T{
826 Identical to \fBuname \-r\fR output\&.
827 T}
828 T{
829 "%%"
830 T}:T{
831 Escaped %
832 T}:T{
833 Single percent sign\&.
834 T}
835 .TE
836 .sp 1
837 .SH "SEE ALSO"
838 .PP
839 \fBsystemd\fR(1),
840 \fBsystemctl\fR(8),
841 \fBsystemd.special\fR(7),
842 \fBsystemd.service\fR(5),
843 \fBsystemd.socket\fR(5),
844 \fBsystemd.device\fR(5),
845 \fBsystemd.mount\fR(5),
846 \fBsystemd.automount\fR(5),
847 \fBsystemd.swap\fR(5),
848 \fBsystemd.target\fR(5),
849 \fBsystemd.path\fR(5),
850 \fBsystemd.timer\fR(5),
851 \fBsystemd.snapshot\fR(5),
852 \fBsystemd.scope\fR(5),
853 \fBsystemd.slice\fR(5),
854 \fBsystemd.time\fR(7),
855 \fBcapabilities\fR(7),
856 \fBsystemd.directives\fR(7),
857 \fBuname\fR(1)
858 .SH "NOTES"
859 .IP " 1." 4
860 XDG Desktop Entry Specification
861 .RS 4
862 \%http://standards.freedesktop.org/desktop-entry-spec/latest/
863 .RE
864 .IP " 2." 4
865 Interface Stability Promise
866 .RS 4
867 \%http://www.freedesktop.org/wiki/Software/systemd/InterfaceStabilityPromise
868 .RE
869 .IP " 3." 4
870 Generators
871 .RS 4
872 \%http://www.freedesktop.org/wiki/Software/systemd/Generators/
873 .RE