]> git.proxmox.com Git - systemd.git/blame - man/systemd.unit.5
Imported Upstream version 217
[systemd.git] / man / systemd.unit.5
CommitLineData
14228c0d 1'\" t
5eef597e 2.TH "SYSTEMD\&.UNIT" "5" "" "systemd 217" "systemd.unit"
14228c0d
MB
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"
23systemd.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
60f067b4 48$XDG_CONFIG_HOME/systemd/user/*
14228c0d
MB
49$HOME/\&.config/systemd/user/*
50/etc/systemd/user/*
5eef597e 51$XDG_RUNTIME_DIR/systemd/user/*
14228c0d 52/run/systemd/user/*
5eef597e
MP
53$XDG_DATA_HOME/systemd/user/*
54$HOME/\&.local/share/systemd/user/*
14228c0d
MB
55/usr/lib/systemd/user/*
56\&.\&.\&.
57
58.fi
59.SH "DESCRIPTION"
60.PP
61A 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
62\fBsystemd\fR(1), a temporary system state snapshot, a resource management slice or a group of externally created processes\&. The syntax is inspired by
63\m[blue]\fBXDG Desktop Entry Specification\fR\m[]\&\s-2\u[1]\d\s+2\&.desktop
64files, which are in turn inspired by Microsoft Windows
65\&.ini
66files\&.
67.PP
68This 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\&.
69.PP
70In 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:
71\fBsystemd.service\fR(5),
72\fBsystemd.socket\fR(5),
73\fBsystemd.device\fR(5),
74\fBsystemd.mount\fR(5),
75\fBsystemd.automount\fR(5),
76\fBsystemd.swap\fR(5),
77\fBsystemd.target\fR(5),
78\fBsystemd.path\fR(5),
79\fBsystemd.timer\fR(5),
80\fBsystemd.snapshot\fR(5)\&.
81\fBsystemd.slice\fR(5)\&.
82\fBsystemd.scope\fR(5)\&.
83.PP
60f067b4
JS
84Various settings are allowed to be specified more than once, in which case the interpretation depends on the setting\&. Often, multiple settings form a list, and setting to an empty value "resets", which means that previous assignments are ignored\&. When this is allowed, it is mentioned in the description of the setting\&. Note that using multiple assignments to the same value makes the unit file incompatible with parsers for the XDG
85\&.desktop
86file format\&.
87.PP
14228c0d
MB
88Unit files are loaded from a set of paths determined during compilation, described in the next section\&.
89.PP
60f067b4
JS
90Unit 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 or section name is prefixed with
91\fBX\-\fR, it is ignored completely by systemd\&. Options within an ignored section do not need the prefix\&. Applications may use this to include additional information in the unit files\&.
14228c0d
MB
92.PP
93Boolean arguments used in unit files can be written in various formats\&. For positive settings the strings
94\fB1\fR,
95\fByes\fR,
96\fBtrue\fR
97and
98\fBon\fR
99are equivalent\&. For negative settings, the strings
100\fB0\fR,
101\fBno\fR,
102\fBfalse\fR
103and
104\fBoff\fR
105are equivalent\&.
106.PP
107Time 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
108\fBsystemd.time\fR(7)\&.
109.PP
110Empty 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\&.
111.PP
112Along with a unit file
113foo\&.service, the directory
114foo\&.service\&.wants/
115may exist\&. All unit files symlinked from such a directory are implicitly added as dependencies of type
5eef597e 116\fIWants=\fR
14228c0d 117to 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
5eef597e 118\fIWants=\fR, see below\&. The preferred way to create symlinks in the
14228c0d
MB
119\&.wants/
120directory of a unit file is with the
121\fBenable\fR
122command of the
123\fBsystemctl\fR(1)
124tool which reads information from the [Install] section of unit files (see below)\&. A similar functionality exists for
125\fIRequires=\fR
126type dependencies as well, the directory suffix is
127\&.requires/
128in this case\&.
129.PP
130Along with a unit file
131foo\&.service, a directory
132foo\&.service\&.d/
133may exist\&. All files with the suffix
134"\&.conf"
5eef597e
MP
135from 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\&. Note that for instanced units this logic will first look for the instance
136"\&.d/"
137subdirectory and read its
138"\&.conf"
139files, followed by the template
140"\&.d/"
141subdirectory and reads its
142"\&.conf"
143files\&.
14228c0d 144.PP
14228c0d
MB
145Note 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\&.
146.PP
147Some unit names reflect paths existing in the file system namespace\&. Example: a device unit
148dev\-sda\&.device
149refers to a device with the device node
150/dev/sda
5eef597e 151in 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 "\ex2d" 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\&.
14228c0d 152.PP
60f067b4 153Optionally, 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 file system\&. If that yields no success and the unit name contains an
14228c0d
MB
154"@"
155character, systemd will look for a unit template that shares the same name but with the instance string (i\&.e\&. the part between the
156"@"
157character and the suffix) removed\&. Example: if a service
158getty@tty3\&.service
159is requested and no file by that name is found, systemd will look for
160getty@\&.service
161and instantiate a service from that configuration file if it is found\&.
162.PP
163To refer to the instance string from within the configuration file you may use the special
164"%i"
165specifier in many of the configuration options\&. See below for details\&.
166.PP
167If a unit file is empty (i\&.e\&. has the file size 0) or is symlinked to
168/dev/null, its configuration will not be loaded and it appears with a load state of
169"masked", and cannot be activated\&. Use this as an effective way to fully disable a unit, making it impossible to start it even manually\&.
170.PP
171The unit file format is covered by the
172\m[blue]\fBInterface Stability Promise\fR\m[]\&\s-2\u[2]\d\s+2\&.
173.SH "UNIT LOAD PATH"
174.PP
175Unit 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\&.
176.PP
177When systemd is running in user mode (\fB\-\-user\fR) and the variable
178\fI$SYSTEMD_UNIT_PATH\fR
5eef597e
MP
179is set, this contents of this variable overrides the unit load path\&. If
180\fI$SYSTEMD_UNIT_PATH\fR
181ends with an empty component (":"), the usual unit load path will be appended to the contents of the variable\&.
14228c0d
MB
182.sp
183.it 1 an-trap
184.nr an-no-space-flag 1
185.nr an-break-flag 1
186.br
187.B Table\ \&1.\ \& Load path when running in system mode (\-\-system).
188.TS
189allbox tab(:);
190lB lB.
191T{
192Path
193T}:T{
194Description
195T}
196.T&
197l l
198l l
199l l.
200T{
201/etc/systemd/system
202T}:T{
203Local configuration
204T}
205T{
206/run/systemd/system
207T}:T{
208Runtime units
209T}
210T{
211/usr/lib/systemd/system
212T}:T{
213Units of installed packages
214T}
215.TE
216.sp 1
217.sp
218.it 1 an-trap
219.nr an-no-space-flag 1
220.nr an-break-flag 1
221.br
222.B Table\ \&2.\ \& Load path when running in user mode (\-\-user).
223.TS
224allbox tab(:);
225lB lB.
226T{
227Path
228T}:T{
229Description
230T}
231.T&
232l l
233l l
234l l
60f067b4 235l l
5eef597e
MP
236l l
237l l
238l l
14228c0d
MB
239l l.
240T{
60f067b4
JS
241$XDG_CONFIG_HOME/systemd/user
242T}:T{
243User configuration (only used when $XDG_CONFIG_HOME is set)
244T}
245T{
14228c0d
MB
246$HOME/\&.config/systemd/user
247T}:T{
60f067b4 248User configuration (only used when $XDG_CONFIG_HOME is not set)
14228c0d
MB
249T}
250T{
251/etc/systemd/user
252T}:T{
253Local configuration
254T}
255T{
5eef597e
MP
256$XDG_RUNTIME_DIR/systemd/user
257T}:T{
258Runtime units (only used when $XDG_RUNTIME_DIR is set)
259T}
260T{
14228c0d
MB
261/run/systemd/user
262T}:T{
263Runtime units
264T}
265T{
5eef597e
MP
266$XDG_DATA_HOME/systemd/user
267T}:T{
268Units of packages that have been installed in the home directory (only used when $XDG_DATA_HOME is set)
269T}
270T{
271$HOME/\&.local/share/systemd/user
272T}:T{
273Units of packages that have been installed in the home directory (only used when $XDG_DATA_HOME is not set)
274T}
275T{
14228c0d
MB
276/usr/lib/systemd/user
277T}:T{
5eef597e 278Units of packages that have been installed system\-wide
14228c0d
MB
279T}
280.TE
281.sp 1
282.PP
283Additional units might be loaded into systemd ("linked") from directories not on the unit load path\&. See the
284\fBlink\fR
285command for
286\fBsystemctl\fR(1)\&. Also, some units are dynamically created via generators
287\m[blue]\fBGenerators\fR\m[]\&\s-2\u[3]\d\s+2\&.
60f067b4 288.SH "[UNIT] SECTION OPTIONS"
14228c0d
MB
289.PP
290Unit file may include a [Unit] section, which carries generic information about the unit that is not dependent on the type of unit:
291.PP
292\fIDescription=\fR
293.RS 4
294A 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\&.
295"Apache2 Web Server"
296is a good example\&. Bad examples are
297"high\-performance light\-weight HTTP server"
298(too generic) or
299"Apache2"
300(too specific and meaningless for people who do not know Apache)\&.
301.RE
302.PP
303\fIDocumentation=\fR
304.RS 4
305A space\-separated list of URIs referencing documentation for this unit or its configuration\&. Accepted are only URIs of the types
306"http://",
307"https://",
308"file:",
309"info:",
310"man:"\&. For more information about the syntax of these URIs, see
60f067b4 311\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\&.
14228c0d
MB
312.RE
313.PP
314\fIRequires=\fR
315.RS 4
60f067b4 316Configures 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 or multiple space\-separated units may be specified in one option in which case requirement dependencies for all listed names will be 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
14228c0d
MB
317\fIAfter=\fR
318or
319\fIBefore=\fR
320options\&. If a unit
321foo\&.service
322requires a unit
323bar\&.service
324as configured with
325\fIRequires=\fR
326and no ordering is configured with
327\fIAfter=\fR
328or
329\fIBefore=\fR, then both units will be started simultaneously and without any delay between them if
330foo\&.service
331is activated\&. Often it is a better choice to use
332\fIWants=\fR
333instead of
334\fIRequires=\fR
335in order to achieve a system that is more robust when dealing with failing services\&.
336.sp
337Note that dependencies of this type may also be configured outside of the unit configuration file by adding a symlink to a
338\&.requires/
339directory accompanying the unit file\&. For details see above\&.
340.RE
341.PP
342\fIRequiresOverridable=\fR
343.RS 4
344Similar to
345\fIRequires=\fR\&. Dependencies listed in
346\fIRequiresOverridable=\fR
347which 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\&.
348.RE
349.PP
350\fIRequisite=\fR, \fIRequisiteOverridable=\fR
351.RS 4
352Similar to
353\fIRequires=\fR
354and
60f067b4 355\fIRequiresOverridable=\fR, respectively\&. However, if the units listed here are not started already, they will not be started and the transaction will fail immediately\&.
14228c0d
MB
356.RE
357.PP
358\fIWants=\fR
359.RS 4
360A weaker version of
60f067b4 361\fIRequires=\fR\&. Units listed in this option will be started if the configuring unit is\&. However, if the listed units fail to start 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\&.
14228c0d 362.sp
60f067b4 363Note that dependencies of this type may also be configured outside of the unit configuration file by adding symlinks to a
14228c0d 364\&.wants/
60f067b4 365directory accompanying the unit file\&. For details, see above\&.
14228c0d
MB
366.RE
367.PP
368\fIBindsTo=\fR
369.RS 4
370Configures requirement dependencies, very similar in style to
60f067b4 371\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\&.
14228c0d
MB
372.RE
373.PP
374\fIPartOf=\fR
375.RS 4
376Configures dependencies similar to
60f067b4 377\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\ \&\(em changes to this unit do not affect the listed units\&.
14228c0d
MB
378.RE
379.PP
380\fIConflicts=\fR
381.RS 4
60f067b4 382A space\-separated list of unit names\&. Configures negative requirement dependencies\&. If a unit has a
14228c0d
MB
383\fIConflicts=\fR
384setting on another unit, starting the former will stop the latter and vice versa\&. Note that this setting is independent of and orthogonal to the
385\fIAfter=\fR
386and
387\fIBefore=\fR
388ordering dependencies\&.
389.sp
60f067b4 390If 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\&.
14228c0d
MB
391.RE
392.PP
393\fIBefore=\fR, \fIAfter=\fR
394.RS 4
60f067b4 395A space\-separated list of unit names\&. Configures ordering dependencies between units\&. If a unit
14228c0d
MB
396foo\&.service
397contains a setting
398\fBBefore=bar\&.service\fR
399and both units are being started,
400bar\&.service\*(Aqs start\-up is delayed until
401foo\&.service
402is started up\&. Note that this setting is independent of and orthogonal to the requirement dependencies as configured by
403\fIRequires=\fR\&. It is a common pattern to include a unit name in both the
404\fIAfter=\fR
405and
406\fIRequires=\fR
60f067b4 407option, 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\&.
14228c0d
MB
408\fIAfter=\fR
409is the inverse of
410\fIBefore=\fR, i\&.e\&. while
411\fIAfter=\fR
412ensures that the configured unit is started after the listed unit finished starting up,
413\fIBefore=\fR
414ensures 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
415\fIAfter=\fR
60f067b4 416on 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 of whether the ordering dependency is actually of type
14228c0d
MB
417\fIAfter=\fR
418or
419\fIBefore=\fR\&. If two units have no ordering dependencies between them, they are shut down or started up simultaneously, and no ordering takes place\&.
420.RE
421.PP
422\fIOnFailure=\fR
423.RS 4
60f067b4 424A space\-separated list of one or more units that are activated when this unit enters the
14228c0d
MB
425"failed"
426state\&.
427.RE
428.PP
429\fIPropagatesReloadTo=\fR, \fIReloadPropagatedFrom=\fR
430.RS 4
60f067b4
JS
431A space\-separated list of one or more units where reload requests on this unit will be propagated to, or reload requests on the other unit will be propagated to this unit, respectively\&. 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\&.
432.RE
433.PP
434\fIJoinsNamespaceOf=\fR
435.RS 4
436For units that start processes (such as service units), lists one or more other units whose network and/or temporary file namespace to join\&. This only applies to unit types which support the
437\fIPrivateNetwork=\fR
438and
439\fIPrivateTmp=\fR
440directives (see
441\fBsystemd.exec\fR(5)
442for details)\&. If a unit that has this setting set is started, its processes will see the same
443/tmp,
444/tmp/var
445and network namespace as one listed unit that is started\&. If multiple listed units are already started, it is not defined which namespace is joined\&. Note that this setting only has an effect if
446\fIPrivateNetwork=\fR
447and/or
448\fIPrivateTmp=\fR
449is enabled for both the unit that joins the namespace and the unit whose namespace is joined\&.
14228c0d
MB
450.RE
451.PP
452\fIRequiresMountsFor=\fR
453.RS 4
454Takes a space\-separated list of absolute paths\&. Automatically adds dependencies of type
455\fIRequires=\fR
456and
457\fIAfter=\fR
458for all mount units required to access the specified path\&.
60f067b4
JS
459.sp
460Mount points marked with
461\fBnoauto\fR
462are not mounted automatically and will be ignored for the purposes of this option\&. If such a mount should be a requirement for this unit, direct dependencies on the mount units may be added (\fIRequires=\fR
463and
464\fIAfter=\fR
465or some other combination)\&.
14228c0d
MB
466.RE
467.PP
60f067b4 468\fIOnFailureJobMode=\fR
14228c0d 469.RS 4
60f067b4
JS
470Takes a value of
471"fail",
472"replace",
473"replace\-irreversibly",
474"isolate",
475"flush",
476"ignore\-dependencies"
477or
478"ignore\-requirements"\&. Defaults to
479"replace"\&. Specifies how the units listed in
14228c0d 480\fIOnFailure=\fR
60f067b4
JS
481will be enqueued\&. See
482\fBsystemctl\fR(1)\*(Aqs
483\fB\-\-job\-mode=\fR
484option for details on the possible values\&. If this is set to
485"isolate", only a single unit may be listed in
486\fIOnFailure=\fR\&.\&.
14228c0d
MB
487.RE
488.PP
489\fIIgnoreOnIsolate=\fR
490.RS 4
491Takes a boolean argument\&. If
492\fBtrue\fR, this unit will not be stopped when isolating another unit\&. Defaults to
493\fBfalse\fR\&.
494.RE
495.PP
496\fIIgnoreOnSnapshot=\fR
497.RS 4
498Takes a boolean argument\&. If
499\fBtrue\fR, this unit will not be included in snapshots\&. Defaults to
500\fBtrue\fR
501for device and snapshot units,
502\fBfalse\fR
503for the others\&.
504.RE
505.PP
506\fIStopWhenUnneeded=\fR
507.RS 4
508Takes a boolean argument\&. If
509\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
510\fBfalse\fR\&.
511.RE
512.PP
513\fIRefuseManualStart=\fR, \fIRefuseManualStop=\fR
514.RS 4
515Takes a boolean argument\&. If
516\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
517\fBfalse\fR\&.
518.RE
519.PP
520\fIAllowIsolate=\fR
521.RS 4
522Takes a boolean argument\&. If
523\fBtrue\fR, this unit may be used with the
524\fBsystemctl isolate\fR
525command\&. 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
526\fBfalse\fR\&.
527.RE
528.PP
529\fIDefaultDependencies=\fR
530.RS 4
531Takes a boolean argument\&. If
532\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
533\fBfalse\fR\&. It is highly recommended to leave this option enabled for the majority of common units\&. If set to
534\fBfalse\fR, this option does not disable all implicit dependencies, just non\-essential ones\&.
535.RE
536.PP
5eef597e 537\fIJobTimeoutSec=\fR, \fIJobTimeoutAction=\fR, \fIJobTimeoutRebootArgument=\fR
14228c0d 538.RS 4
5eef597e 539When a job for this unit is queued a time\-out may be configured\&. If this time limit is reached, the job will be cancelled, the unit however will not change state or even enter the
14228c0d
MB
540"failed"
541mode\&. 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
5eef597e 542\fIStartTimeoutSec=\fR
14228c0d 543in 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\&.
5eef597e
MP
544.sp
545\fIJobTimeoutAction=\fR
546optionally configures an additional action to take when the time\-out is hit\&. It takes the same values as the per\-service
547\fIStartLimitAction=\fR
548setting, see
549\fBsystemd.service\fR(5)
550for details\&. Defaults to
551\fBnone\fR\&.
552\fIJobTimeoutRebootArgument=\fR
553configures an optional reboot string to pass to the
554\fBreboot\fR(2)
555system call\&.
14228c0d
MB
556.RE
557.PP
5eef597e 558\fIConditionArchitecture=\fR, \fIConditionVirtualization=\fR, \fIConditionHost=\fR, \fIConditionKernelCommandLine=\fR, \fIConditionSecurity=\fR, \fIConditionCapability=\fR, \fIConditionACPower=\fR, \fIConditionNeedsUpdate=\fR, \fIConditionFirstBoot=\fR, \fIConditionPathExists=\fR, \fIConditionPathExistsGlob=\fR, \fIConditionPathIsDirectory=\fR, \fIConditionPathIsSymbolicLink=\fR, \fIConditionPathIsMountPoint=\fR, \fIConditionPathIsReadWrite=\fR, \fIConditionDirectoryNotEmpty=\fR, \fIConditionFileNotEmpty=\fR, \fIConditionFileIsExecutable=\fR, \fIConditionNull=\fR
14228c0d
MB
559.RS 4
560Before 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\&.
561.sp
60f067b4
JS
562\fIConditionArchitecture=\fR
563may be used to check whether the system is running on a specific architecture\&. Takes one of
564\fIx86\fR,
565\fIx86\-64\fR,
566\fIppc\fR,
5eef597e 567\fIppc\-le\fR,
60f067b4 568\fIppc64\fR,
5eef597e 569\fIppc64\-le\fR,
60f067b4
JS
570\fIia64\fR,
571\fIparisc\fR,
572\fIparisc64\fR,
573\fIs390\fR,
574\fIs390x\fR,
575\fIsparc\fR,
576\fIsparc64\fR,
577\fImips\fR,
5eef597e 578\fImips\-le\fR,
60f067b4 579\fImips64\fR,
5eef597e 580\fImips64\-le\fR,
60f067b4
JS
581\fIalpha\fR,
582\fIarm\fR,
583\fIarm\-be\fR,
584\fIarm64\fR,
585\fIarm64\-be\fR,
586\fIsh\fR,
587\fIsh64\fR,
5eef597e
MP
588\fIm86k\fR,
589\fItilegx\fR,
590\fIcris\fR
60f067b4
JS
591to test against a specific architecture\&. The architecture is determined from the information returned by
592\fBuname\fR(2)
593and is thus subject to
594\fBpersonality\fR(2)\&. Note that a
595\fIPersonality=\fR
596setting in the same unit file has no effect on this condition\&. A special architecture name
597\fInative\fR
598is mapped to the architecture the system manager itself is compiled for\&. The test may be negated by prepending an exclamation mark\&.
599.sp
600\fIConditionVirtualization=\fR
601may 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
602\fIvm\fR
603and
604\fIcontainer\fR
605to test against a generic type of virtualization solution, or one of
606\fIqemu\fR,
607\fIkvm\fR,
5eef597e 608\fIzvm\fR,
60f067b4
JS
609\fIvmware\fR,
610\fImicrosoft\fR,
611\fIoracle\fR,
612\fIxen\fR,
613\fIbochs\fR,
60f067b4
JS
614\fIuml\fR,
615\fIopenvz\fR,
616\fIlxc\fR,
617\fIlxc\-libvirt\fR,
5eef597e
MP
618\fIsystemd\-nspawn\fR,
619\fIdocker\fR
620to test against a specific implementation\&. See
621\fBsystemd-detect-virt\fR(1)
622for a full list of known virtualization technologies and their identifiers\&. If multiple virtualization technologies are nested, only the innermost is considered\&. The test may be negated by prepending an exclamation mark\&.
60f067b4
JS
623.sp
624\fIConditionHost=\fR
625may 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
626\fBgethostname\fR(2), or a machine ID formatted as string (see
627\fBmachine-id\fR(5))\&. The test may be negated by prepending an exclamation mark\&.
628.sp
629\fIConditionKernelCommandLine=\fR
630may 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
631"=")\&. 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\&.
632.sp
633\fIConditionSecurity=\fR
634may be used to check whether the given security module is enabled on the system\&. Currently the recognized values values are
635\fIselinux\fR,
636\fIapparmor\fR,
637\fIima\fR
638and
639\fIsmack\fR\&. The test may be negated by prepending an exclamation mark\&.
640.sp
641\fIConditionCapability=\fR
642may 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
643\fBcapabilities\fR(7)
644for details)\&. Pass a capability name such as
645"CAP_MKNOD", possibly prefixed with an exclamation mark to negate the check\&.
646.sp
647\fIConditionACPower=\fR
648may 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
649\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
650\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\&.
651.sp
e842803a
MB
652\fIConditionNeedsUpdate=\fR
653takes one of
654/var
655or
656/etc
657as argument, possibly prefixed with a
658"!"
659(for inverting the condition)\&. This condition may be used to conditionalize units on whether the specified directory requires an update because
660/usr\*(Aqs modification time is newer than the stamp file
661\&.updated
662in the specified directory\&. This is useful to implement offline updates of the vendor operating system resources in
663/usr
664that require updating of
665/etc
666or
667/var
668on the next following boot\&. Units making use of this condition should order themselves before
669\fBsystemd-update-done.service\fR(8), to make sure they run before the stamp files\*(Aqs modification time gets reset indicating a completed update\&.
670.sp
5eef597e
MP
671\fIConditionFirstBoot=\fR
672takes a boolean argument\&. This condition may be used to conditionalize units on whether the system is booting up with an unpopulated
673/etc
674directory\&. This may be used to populate
675/etc
676on the first boot after factory reset, or when a new system instances boots up for the first time\&.
677.sp
14228c0d
MB
678With
679\fIConditionPathExists=\fR
680a 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
681\fIConditionPathExists=\fR
682is prefixed with an exclamation mark ("!"), the test is negated, and the unit is only started if the path does not exist\&.
683.sp
684\fIConditionPathExistsGlob=\fR
685is similar to
686\fIConditionPathExists=\fR, but checks for the existence of at least one file or directory matching the specified globbing pattern\&.
687.sp
688\fIConditionPathIsDirectory=\fR
689is similar to
690\fIConditionPathExists=\fR
691but verifies whether a certain path exists and is a directory\&.
692.sp
693\fIConditionPathIsSymbolicLink=\fR
694is similar to
695\fIConditionPathExists=\fR
696but verifies whether a certain path exists and is a symbolic link\&.
697.sp
698\fIConditionPathIsMountPoint=\fR
699is similar to
700\fIConditionPathExists=\fR
701but verifies whether a certain path exists and is a mount point\&.
702.sp
703\fIConditionPathIsReadWrite=\fR
704is similar to
705\fIConditionPathExists=\fR
706but verifies whether the underlying file system is readable and writable (i\&.e\&. not mounted read\-only)\&.
707.sp
708\fIConditionDirectoryNotEmpty=\fR
709is similar to
710\fIConditionPathExists=\fR
711but verifies whether a certain path exists and is a non\-empty directory\&.
712.sp
713\fIConditionFileNotEmpty=\fR
714is similar to
715\fIConditionPathExists=\fR
716but verifies whether a certain path exists and refers to a regular file with a non\-zero size\&.
717.sp
718\fIConditionFileIsExecutable=\fR
719is similar to
720\fIConditionPathExists=\fR
721but verifies whether a certain path exists, is a regular file and marked executable\&.
722.sp
14228c0d
MB
723Finally,
724\fIConditionNull=\fR
725may be used to add a constant condition check value to the unit\&. It takes a boolean argument\&. If set to
726\fIfalse\fR, the condition will always fail, otherwise succeed\&.
727.sp
728If 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
729\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\&.
730.RE
731.PP
732\fISourcePath=\fR
733.RS 4
e842803a 734A 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\&. This functionality should not be used in normal units\&.
14228c0d 735.RE
60f067b4 736.SH "[INSTALL] SECTION OPTIONS"
14228c0d 737.PP
5eef597e
MP
738Unit file may include an
739"[Install]"
740section, which carries installation information for the unit\&. This section is not interpreted by
14228c0d
MB
741\fBsystemd\fR(1)
742during runtime\&. It is used exclusively by the
743\fBenable\fR
744and
745\fBdisable\fR
746commands of the
747\fBsystemctl\fR(1)
748tool during installation of a unit:
749.PP
750\fIAlias=\fR
751.RS 4
5eef597e 752A 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 file name\&. This option may be specified more than once, in which case all listed names are used\&. At installation time,
14228c0d
MB
753\fBsystemctl enable\fR
754will create symlinks from these names to the unit filename\&.
755.RE
756.PP
757\fIWantedBy=\fR, \fIRequiredBy=\fR
758.RS 4
60f067b4 759This 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
14228c0d
MB
760\&.wants/
761or
762\&.requires/
60f067b4 763directory of each of the listed units when this unit is installed by
14228c0d
MB
764\fBsystemctl enable\fR\&. This has the effect that a dependency of type
765\fIWants=\fR
766or
767\fIRequires=\fR
768is 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
769\fIWants=\fR
770and
771\fIRequires=\fR
772in the [Unit] section for details\&.
773.sp
774\fBWantedBy=foo\&.service\fR
775in a service
776bar\&.service
777is mostly equivalent to
778\fBAlias=foo\&.service\&.wants/bar\&.service\fR
779in the same file\&. In case of template units,
780\fBsystemctl enable\fR
781must be called with an instance name, and this instance will be added to the
782\&.wants/
783or
784\&.requires/
785list of the listed unit\&. E\&.g\&.
786\fBWantedBy=getty\&.target\fR
787in a service
788getty@\&.service
789will result in
790\fBsystemctl enable getty@tty2\&.service\fR
791creating a
792getty\&.target\&.wants/getty@tty2\&.service
793link to
794getty@\&.service\&.
795.RE
796.PP
797\fIAlso=\fR
798.RS 4
799Additional units to install/deinstall when this unit is installed/deinstalled\&. If the user requests installation/deinstallation of a unit with this option configured,
800\fBsystemctl enable\fR
801and
802\fBsystemctl disable\fR
803will automatically install/uninstall units listed in this option as well\&.
60f067b4
JS
804.sp
805This option may be used more than once, or a space\-separated list of unit names may be given\&.
14228c0d
MB
806.RE
807.PP
e842803a
MB
808\fIDefaultInstance=\fR
809.RS 4
810In template unit files, this specifies for which instance the unit shall be enabled if the template is enabled without any explicitly set instance\&. This option has no effect in non\-template unit files\&. The specified string must be usable as instance identifier\&.
811.RE
812.PP
14228c0d
MB
813The 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\&.
814.SH "SPECIFIERS"
815.PP
816Many 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:
817.sp
818.it 1 an-trap
819.nr an-no-space-flag 1
820.nr an-break-flag 1
821.br
822.B Table\ \&3.\ \&Specifiers available in unit files
823.TS
824allbox tab(:);
825lB lB lB.
826T{
827Specifier
828T}:T{
829Meaning
830T}:T{
831Details
832T}
833.T&
834l l l
835l l l
836l l l
837l l l
838l l l
839l l l
840l l l
841l l l
842l l l
843l l l
844l l l
845l l l
846l l l
847l l l
848l l l
849l l l
850l l l
851l l l
852l l l
853l l l.
854T{
855"%n"
856T}:T{
857Full unit name
858T}:T{
859\ \&
860T}
861T{
862"%N"
863T}:T{
864Unescaped full unit name
865T}:T{
60f067b4 866Same as "%n", but with escaping undone
14228c0d
MB
867T}
868T{
869"%p"
870T}:T{
871Prefix name
872T}:T{
60f067b4 873For instantiated units, this refers to the string before the "@" character of the unit name\&. For non\-instantiated units, this refers to the name of the unit with the type suffix removed\&.
14228c0d
MB
874T}
875T{
876"%P"
877T}:T{
878Unescaped prefix name
879T}:T{
60f067b4 880Same as "%p", but with escaping undone
14228c0d
MB
881T}
882T{
883"%i"
884T}:T{
885Instance name
886T}:T{
60f067b4 887For instantiated units: this is the string between the "@" character and the suffix of the unit name\&.
14228c0d
MB
888T}
889T{
890"%I"
891T}:T{
892Unescaped instance name
893T}:T{
60f067b4 894Same as "%i", but with escaping undone
14228c0d
MB
895T}
896T{
897"%f"
898T}:T{
899Unescaped filename
900T}:T{
60f067b4 901This is either the unescaped instance name (if applicable) with / prepended (if applicable), or the prefix name prepended with /\&.
14228c0d
MB
902T}
903T{
904"%c"
905T}:T{
906Control group path of the unit
907T}:T{
60f067b4 908This path does not include the /sys/fs/cgroup/systemd/ prefix\&.
14228c0d
MB
909T}
910T{
911"%r"
912T}:T{
60f067b4 913Control group path of the slice the unit is placed in
14228c0d 914T}:T{
60f067b4 915This usually maps to the parent cgroup path of "%c"\&.
14228c0d
MB
916T}
917T{
918"%R"
919T}:T{
60f067b4 920Root control group path below which slices and units are placed
14228c0d 921T}:T{
60f067b4 922For system instances, this resolves to /, except in containers, where this maps to the container\*(Aqs root control group path\&.
14228c0d
MB
923T}
924T{
925"%t"
926T}:T{
60f067b4 927Runtime directory
14228c0d 928T}:T{
60f067b4 929This is either /run (for the system manager) or the path "$XDG_RUNTIME_DIR" resolves to (for user managers)\&.
14228c0d
MB
930T}
931T{
932"%u"
933T}:T{
934User name
935T}:T{
936This is the name of the configured user of the unit, or (if none is set) the user running the systemd instance\&.
937T}
938T{
939"%U"
940T}:T{
941User UID
942T}:T{
60f067b4 943This is the numeric UID of the configured user of the unit, or (if none is set) the user running the systemd user instance\&. Note that this specifier is not available for units run by the systemd system instance (as opposed to those run by a systemd user instance), unless the user has been configured as a numeric UID in the first place or the configured user is the root user\&.
14228c0d
MB
944T}
945T{
946"%h"
947T}:T{
948User home directory
949T}:T{
60f067b4 950This is the home directory of the configured user of the unit, or (if none is set) the user running the systemd user instance\&. Similar to "%U", this specifier is not available for units run by the systemd system instance, unless the configured user is the root user\&.
14228c0d
MB
951T}
952T{
953"%s"
954T}:T{
955User shell
956T}:T{
60f067b4 957This is the shell of the configured user of the unit, or (if none is set) the user running the systemd user instance\&. Similar to "%U", this specifier is not available for units run by the systemd system instance, unless the configured user is the root user\&.
14228c0d
MB
958T}
959T{
960"%m"
961T}:T{
962Machine ID
963T}:T{
964The machine ID of the running system, formatted as string\&. See \fBmachine-id\fR(5) for more information\&.
965T}
966T{
967"%b"
968T}:T{
969Boot ID
970T}:T{
971The boot ID of the running system, formatted as string\&. See \fBrandom\fR(4) for more information\&.
972T}
973T{
974"%H"
975T}:T{
976Host name
977T}:T{
60f067b4 978The hostname of the running system at the point in time the unit configuation is loaded\&.
14228c0d
MB
979T}
980T{
981"%v"
982T}:T{
983Kernel release
984T}:T{
60f067b4 985Identical to \fBuname \-r\fR output
14228c0d
MB
986T}
987T{
988"%%"
989T}:T{
60f067b4 990Single percent sign
14228c0d 991T}:T{
60f067b4 992Use "%%" in place of "%" to specify a single percent sign\&.
14228c0d
MB
993T}
994.TE
995.sp 1
996.SH "SEE ALSO"
997.PP
998\fBsystemd\fR(1),
5eef597e 999\fBsystemctl\fR(1),
14228c0d
MB
1000\fBsystemd.special\fR(7),
1001\fBsystemd.service\fR(5),
1002\fBsystemd.socket\fR(5),
1003\fBsystemd.device\fR(5),
1004\fBsystemd.mount\fR(5),
1005\fBsystemd.automount\fR(5),
1006\fBsystemd.swap\fR(5),
1007\fBsystemd.target\fR(5),
1008\fBsystemd.path\fR(5),
1009\fBsystemd.timer\fR(5),
1010\fBsystemd.snapshot\fR(5),
1011\fBsystemd.scope\fR(5),
1012\fBsystemd.slice\fR(5),
1013\fBsystemd.time\fR(7),
5eef597e 1014\fBsystemd-verify\fR(1),
14228c0d
MB
1015\fBcapabilities\fR(7),
1016\fBsystemd.directives\fR(7),
1017\fBuname\fR(1)
1018.SH "NOTES"
1019.IP " 1." 4
1020XDG Desktop Entry Specification
1021.RS 4
1022\%http://standards.freedesktop.org/desktop-entry-spec/latest/
1023.RE
1024.IP " 2." 4
1025Interface Stability Promise
1026.RS 4
1027\%http://www.freedesktop.org/wiki/Software/systemd/InterfaceStabilityPromise
1028.RE
1029.IP " 3." 4
1030Generators
1031.RS 4
1032\%http://www.freedesktop.org/wiki/Software/systemd/Generators/
1033.RE