]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/systemctl.xml
test/test-functions: avoid stderr noise, only umount on cleanup if mountpoint
[thirdparty/systemd.git] / man / systemctl.xml
CommitLineData
514094f9 1<?xml version='1.0'?>
3a54a157
ZJS
2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
681eb9cf
FB
4<!ENTITY % entities SYSTEM "custom-entities.ent" >
5%entities;
6]>
0307f791 7<!-- SPDX-License-Identifier: LGPL-2.1+ -->
7874bcd6 8
21ac6ff1
ZJS
9<refentry id="systemctl"
10 xmlns:xi="http://www.w3.org/2001/XInclude">
7874bcd6 11
4a6022f0
ZJS
12 <refentryinfo>
13 <title>systemctl</title>
14 <productname>systemd</productname>
4a6022f0
ZJS
15 </refentryinfo>
16
17 <refmeta>
18 <refentrytitle>systemctl</refentrytitle>
19 <manvolnum>1</manvolnum>
20 </refmeta>
21
22 <refnamediv>
23 <refname>systemctl</refname>
24 <refpurpose>Control the systemd system and service manager</refpurpose>
25 </refnamediv>
26
27 <refsynopsisdiv>
28 <cmdsynopsis>
29 <command>systemctl</command>
30 <arg choice="opt" rep="repeat">OPTIONS</arg>
31 <arg choice="plain">COMMAND</arg>
da5e955f 32 <arg choice="opt" rep="repeat">UNIT</arg>
4a6022f0
ZJS
33 </cmdsynopsis>
34 </refsynopsisdiv>
35
36 <refsect1>
37 <title>Description</title>
38
a4390b6b
LP
39 <para><command>systemctl</command> may be used to introspect and
40 control the state of the <literal>systemd</literal> system and
41 service manager. Please refer to
4a6022f0 42 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>
a4390b6b
LP
43 for an introduction into the basic concepts and functionality this
44 tool manages.</para>
4a6022f0
ZJS
45 </refsect1>
46
47 <refsect1>
48 <title>Options</title>
49
50 <para>The following options are understood:</para>
51
52 <variablelist>
4a6022f0
ZJS
53 <varlistentry>
54 <term><option>-t</option></term>
55 <term><option>--type=</option></term>
56
57 <listitem>
e9dd9f95 58 <para>The argument should be a comma-separated list of unit
20b3f379 59 types such as <option>service</option> and
9b9b3d36
MW
60 <option>socket</option>.
61 </para>
20b3f379
ZJS
62
63 <para>If one of the arguments is a unit type, when listing
7b870f60 64 units, limit display to certain unit types. Otherwise, units
4a6022f0
ZJS
65 of all types will be shown.</para>
66
20b3f379 67 <para>As a special case, if one of the arguments is
4a6022f0
ZJS
68 <option>help</option>, a list of allowed values will be
69 printed and the program will exit.</para>
70 </listitem>
71 </varlistentry>
72
9b9b3d36
MW
73 <varlistentry>
74 <term><option>--state=</option></term>
75
76 <listitem>
e16972e6
ZJS
77 <para>The argument should be a comma-separated list of unit
78 LOAD, SUB, or ACTIVE states. When listing units, show only
a8eaaee7 79 those in the specified states. Use <option>--state=failed</option>
e16972e6
ZJS
80 to show only failed units.</para>
81
82 <para>As a special case, if one of the arguments is
83 <option>help</option>, a list of allowed values will be
84 printed and the program will exit.</para>
9b9b3d36
MW
85 </listitem>
86 </varlistentry>
87
4a6022f0
ZJS
88 <varlistentry>
89 <term><option>-p</option></term>
90 <term><option>--property=</option></term>
91
92 <listitem>
54c31a79 93 <para>When showing unit/job/manager properties with the
ea539eb6
ZJS
94 <command>show</command> command, limit display to properties
95 specified in the argument. The argument should be a
d2bbca68 96 comma-separated list of property names, such as
ea539eb6
ZJS
97 <literal>MainPID</literal>. Unless specified, all known
98 properties are shown. If specified more than once, all
99 properties with the specified names are shown. Shell
100 completion is implemented for property names.</para>
101
102 <para>For the manager itself,
103 <command>systemctl show</command> will show all available
104 properties. Those properties are documented in
105 <citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
106 </para>
107
108 <para>Properties for units vary by unit type, so showing any
109 unit (even a non-existent one) is a way to list properties
b938cb90 110 pertaining to this type. Similarly, showing any job will list
ea539eb6
ZJS
111 properties pertaining to all jobs. Properties for units are
112 documented in
113 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
114 and the pages for individual unit types
115 <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
116 <citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
117 etc.</para>
4a6022f0
ZJS
118 </listitem>
119 </varlistentry>
120
121 <varlistentry>
122 <term><option>-a</option></term>
123 <term><option>--all</option></term>
124
125 <listitem>
21b587cf
ZJS
126 <para>When listing units with <command>list-units</command>, also show inactive units and
127 units which are following other units. When showing unit/job/manager properties, show all
128 properties regardless whether they are set or not.</para>
129
130 <para>To list all units installed in the file system, use the
a5e4972c 131 <command>list-unit-files</command> command instead.</para>
e9fbae3f
ZJS
132
133 <para>When listing units with <command>list-dependencies</command>, recursively show
134 dependencies of all dependent units (by default only dependencies of target units are
135 shown).</para>
4fa226ff
LW
136
137 <para>When used with <command>status</command>, show journal messages in full, even if they include
138 unprintable characters or are very long. By default, fields with unprintable characters are
139 abbreviated as "blob data". (Note that the pager may escape unprintable characters again.)</para>
4a6022f0
ZJS
140 </listitem>
141 </varlistentry>
142
1238ee09
LP
143 <varlistentry>
144 <term><option>-r</option></term>
145 <term><option>--recursive</option></term>
146
147 <listitem>
148 <para>When listing units, also show units of local
149 containers. Units of local containers will be prefixed with
150 the container name, separated by a single colon character
151 (<literal>:</literal>).</para>
152 </listitem>
153 </varlistentry>
154
afba4199
ZJS
155 <varlistentry>
156 <term><option>--reverse</option></term>
157
158 <listitem>
159 <para>Show reverse dependencies between units with
f6375e83
ZJS
160 <command>list-dependencies</command>, i.e. follow
161 dependencies of type <varname>WantedBy=</varname>,
162 <varname>RequiredBy=</varname>,
f6375e83
ZJS
163 <varname>PartOf=</varname>, <varname>BoundBy=</varname>,
164 instead of <varname>Wants=</varname> and similar.
afba4199
ZJS
165 </para>
166 </listitem>
167 </varlistentry>
168
169 <varlistentry>
170 <term><option>--after</option></term>
9029f642
JSJ
171
172 <listitem>
173 <para>With <command>list-dependencies</command>, show the
174 units that are ordered before the specified unit. In other
f6375e83
ZJS
175 words, recursively list units following the
176 <varname>After=</varname> dependency.</para>
177
178 <para>Note that any <varname>After=</varname> dependency is
179 automatically mirrored to create a
180 <varname>Before=</varname> dependency. Temporal dependencies
922d948b 181 may be specified explicitly, but are also created implicitly
f6375e83
ZJS
182 for units which are <varname>WantedBy=</varname> targets
183 (see
184 <citerefentry><refentrytitle>systemd.target</refentrytitle><manvolnum>5</manvolnum></citerefentry>),
185 and as a result of other directives (for example
186 <varname>RequiresMountsFor=</varname>). Both explicitly
187 and implicitly introduced dependencies are shown with
188 <command>list-dependencies</command>.</para>
82948f6c
LP
189
190 <para>When passed to the <command>list-jobs</command> command, for each printed job show which other jobs are
191 waiting for it. May be combined with <option>--before</option> to show both the jobs waiting for each job as
192 well as all jobs each job is waiting for.</para>
9029f642
JSJ
193 </listitem>
194 </varlistentry>
195
196 <varlistentry>
afba4199
ZJS
197 <term><option>--before</option></term>
198
199 <listitem>
9029f642
JSJ
200 <para>With <command>list-dependencies</command>, show the
201 units that are ordered after the specified unit. In other
f6375e83
ZJS
202 words, recursively list units following the
203 <varname>Before=</varname> dependency.</para>
82948f6c
LP
204
205 <para>When passed to the <command>list-jobs</command> command, for each printed job show which other jobs it
206 is waiting for. May be combined with <option>--after</option> to show both the jobs waiting for each job as
207 well as all jobs each job is waiting for.</para>
afba4199
ZJS
208 </listitem>
209 </varlistentry>
210
4a6022f0 211 <varlistentry>
98a6e132 212 <term><option>-l</option></term>
4a6022f0
ZJS
213 <term><option>--full</option></term>
214
215 <listitem>
69d918b0
ZJS
216 <para>Do not ellipsize unit names, process tree entries,
217 journal output, or truncate unit descriptions in the output
218 of <command>status</command>, <command>list-units</command>,
219 <command>list-jobs</command>, and
220 <command>list-timers</command>.</para>
3b3557c4
JS
221 <para>Also, show installation targets in the output of
222 <command>is-enabled</command>.</para>
4a6022f0
ZJS
223 </listitem>
224 </varlistentry>
225
4f9a9105
ZJS
226 <varlistentry>
227 <term><option>--value</option></term>
228
229 <listitem>
230 <para>When printing properties with <command>show</command>,
231 only print the value, and skip the property name and
232 <literal>=</literal>.</para>
233 </listitem>
234 </varlistentry>
235
991f2a39
ZJS
236 <varlistentry>
237 <term><option>--show-types</option></term>
238
239 <listitem>
240 <para>When showing sockets, show the type of the socket.</para>
241 </listitem>
242 </varlistentry>
243
23ade460 244 <varlistentry>
4dc5b821 245 <term><option>--job-mode=</option></term>
23ade460
MS
246
247 <listitem>
e0e009c0
JE
248 <para>When queuing a new job, this option controls how to deal with
249 already queued jobs. It takes one of <literal>fail</literal>,
4dc5b821
LP
250 <literal>replace</literal>,
251 <literal>replace-irreversibly</literal>,
252 <literal>isolate</literal>,
253 <literal>ignore-dependencies</literal>,
254 <literal>ignore-requirements</literal> or
255 <literal>flush</literal>. Defaults to
256 <literal>replace</literal>, except when the
257 <command>isolate</command> command is used which implies the
258 <literal>isolate</literal> job mode.</para>
259
260 <para>If <literal>fail</literal> is specified and a requested
261 operation conflicts with a pending job (more specifically:
262 causes an already pending start job to be reversed into a stop
263 job or vice versa), cause the operation to fail.</para>
264
265 <para>If <literal>replace</literal> (the default) is
266 specified, any conflicting pending job will be replaced, as
267 necessary.</para>
268
269 <para>If <literal>replace-irreversibly</literal> is specified,
270 operate like <literal>replace</literal>, but also mark the new
271 jobs as irreversible. This prevents future conflicting
9a92e77e
DS
272 transactions from replacing these jobs (or even being enqueued
273 while the irreversible jobs are still pending). Irreversible
274 jobs can still be cancelled using the <command>cancel</command>
d60cb656
AJ
275 command. This job mode should be used on any transaction which
276 pulls in <filename>shutdown.target</filename>.</para>
4dc5b821
LP
277
278 <para><literal>isolate</literal> is only valid for start
279 operations and causes all other units to be stopped when the
280 specified unit is started. This mode is always used when the
281 <command>isolate</command> command is used.</para>
282
283 <para><literal>flush</literal> will cause all queued jobs to
284 be canceled when the new job is enqueued.</para>
285
286 <para>If <literal>ignore-dependencies</literal> is specified,
287 then all unit dependencies are ignored for this new job and
288 the operation is executed immediately. If passed, no required
289 units of the unit passed will be pulled in, and no ordering
290 dependencies will be honored. This is mostly a debugging and
291 rescue tool for the administrator and should not be used by
292 applications.</para>
293
294 <para><literal>ignore-requirements</literal> is similar to
b040723e 295 <literal>ignore-dependencies</literal>, but only causes the
4dc5b821 296 requirement dependencies to be ignored, the ordering
2dd67817 297 dependencies will still be honored.</para>
23ade460 298 </listitem>
4a6022f0 299
4a6022f0
ZJS
300 </varlistentry>
301
df4a7cb7
LP
302 <varlistentry>
303 <term><option>-T</option></term>
304 <term><option>--show-transaction</option></term>
305
306 <listitem>
307 <para>When enqueuing a unit job (for example as effect of a <command>systemctl start</command>
308 invocation or similar), show brief information about all jobs enqueued, covering both the requested
309 job and any added because of unit dependencies. Note that the output will only include jobs
310 immediately part of the transaction requested. It is possible that service start-up program code
311 run as effect of the enqueued jobs might request further jobs to be pulled in. This means that
312 completion of the listed jobs might ultimately entail more jobs than the listed ones.</para>
313 </listitem>
314 </varlistentry>
315
ac5e3a50
JS
316 <varlistentry>
317 <term><option>--fail</option></term>
318
319 <listitem>
320 <para>Shorthand for <option>--job-mode=</option>fail.</para>
321 <para>When used with the <command>kill</command> command,
322 if no units were killed, the operation results in an error.
323 </para>
324 </listitem>
325 </varlistentry>
326
4a6022f0
ZJS
327 <varlistentry>
328 <term><option>-i</option></term>
329 <term><option>--ignore-inhibitors</option></term>
330
331 <listitem>
81d39f0d
LP
332 <para>When system shutdown or a sleep state is requested, ignore inhibitor locks. Applications can establish
333 inhibitor locks to avoid that certain important operations (such as CD burning or suchlike) are interrupted
334 by system shutdown or a sleep state. Any user may take these locks and privileged users may override these
335 locks. If any locks are taken, shutdown and sleep state requests will normally fail (unless privileged) and a
336 list of active locks is printed. However, if <option>--ignore-inhibitors</option> is specified, the
337 established locks are ignored and not shown, and the operation attempted anyway, possibly requiring
338 additional privileges.</para>
4a6022f0
ZJS
339 </listitem>
340 </varlistentry>
341
1ae17672
ZJS
342 <varlistentry>
343 <term><option>--dry-run</option></term>
344
345 <listitem>
346 <para>Just print what would be done. Currently supported by verbs
347 <command>halt</command>, <command>poweroff</command>, <command>reboot</command>,
6cc2b882
JD
348 <command>kexec</command>, <command>suspend</command>, <command>hibernate</command>,
349 <command>hybrid-sleep</command>, <command>suspend-then-hibernate</command>,
1ae17672
ZJS
350 <command>default</command>, <command>rescue</command>,
351 <command>emergency</command>, and <command>exit</command>.</para>
352 </listitem>
353 </varlistentry>
354
4a6022f0
ZJS
355 <varlistentry>
356 <term><option>-q</option></term>
357 <term><option>--quiet</option></term>
358
359 <listitem>
bbd46aad
ZJS
360 <para>Suppress printing of the results of various commands
361 and also the hints about truncated log lines. This does not
362 suppress output of commands for which the printed output is
363 the only result (like <command>show</command>). Errors are
364 always printed.</para>
4a6022f0
ZJS
365 </listitem>
366 </varlistentry>
367
368 <varlistentry>
369 <term><option>--no-block</option></term>
370
371 <listitem>
372 <para>Do not synchronously wait for the requested operation
7b870f60 373 to finish. If this is not specified, the job will be
4a6022f0 374 verified, enqueued and <command>systemctl</command> will
3d161f99 375 wait until the unit's start-up is completed. By passing this
93a08841
MP
376 argument, it is only verified and enqueued. This option may not be
377 combined with <option>--wait</option>.</para>
378 </listitem>
379 </varlistentry>
380
381 <varlistentry>
382 <term><option>--wait</option></term>
383
384 <listitem>
385 <para>Synchronously wait for started units to terminate again.
386 This option may not be combined with <option>--no-block</option>.
387 Note that this will wait forever if any given unit never terminates
388 (by itself or by getting stopped explicitly); particularly services
389 which use <literal>RemainAfterExit=yes</literal>.</para>
adb6cd9b
FB
390
391 <para>When used with <command>is-system-running</command>, wait
392 until the boot process is completed before returning.</para>
4a6022f0
ZJS
393 </listitem>
394 </varlistentry>
395
88ae7333
ZJS
396 <xi:include href="user-system-options.xml" xpointer="user" />
397 <xi:include href="user-system-options.xml" xpointer="system" />
4a6022f0 398
bef19548
ZJS
399 <varlistentry>
400 <term><option>--failed</option></term>
401
402 <listitem>
403 <para>List units in failed state. This is equivalent to
404 <option>--state=failed</option>.</para>
405 </listitem>
406 </varlistentry>
599b6322 407
4a6022f0
ZJS
408 <varlistentry>
409 <term><option>--no-wall</option></term>
410
411 <listitem>
6324a8a7 412 <para>Do not send wall message before halt, power-off and reboot.</para>
4a6022f0
ZJS
413 </listitem>
414 </varlistentry>
415
416 <varlistentry>
417 <term><option>--global</option></term>
418
419 <listitem>
420 <para>When used with <command>enable</command> and
421 <command>disable</command>, operate on the global user
422 configuration directory, thus enabling or disabling a unit
423 file globally for all future logins of all users.</para>
424 </listitem>
425 </varlistentry>
426
427 <varlistentry>
428 <term><option>--no-reload</option></term>
429
430 <listitem>
431 <para>When used with <command>enable</command> and
432 <command>disable</command>, do not implicitly reload daemon
433 configuration after executing the changes.</para>
434 </listitem>
435 </varlistentry>
436
437 <varlistentry>
438 <term><option>--no-ask-password</option></term>
439
440 <listitem>
441 <para>When used with <command>start</command> and related
442 commands, disables asking for passwords. Background services
443 may require input of a password or passphrase string, for
444 example to unlock system hard disks or cryptographic
445 certificates. Unless this option is specified and the
7b870f60 446 command is invoked from a terminal,
4a6022f0
ZJS
447 <command>systemctl</command> will query the user on the
448 terminal for the necessary secrets. Use this option to
7b870f60 449 switch this behavior off. In this case, the password must be
4a6022f0
ZJS
450 supplied by some other means (for example graphical password
451 agents) or the service might fail. This also disables
452 querying the user for authentication for privileged
453 operations.</para>
454 </listitem>
4a6022f0
ZJS
455 </varlistentry>
456
457 <varlistentry>
458 <term><option>--kill-who=</option></term>
459
460 <listitem>
461 <para>When used with <command>kill</command>, choose which
af7424af
LP
462 processes to send a signal to. Must be one of
463 <option>main</option>, <option>control</option> or
464 <option>all</option> to select whether to kill only the main
465 process, the control process or all processes of the
466 unit. The main process of the unit is the one that defines
467 the life-time of it. A control process of a unit is one that
468 is invoked by the manager to induce state changes of it. For
469 example, all processes started due to the
470 <varname>ExecStartPre=</varname>,
471 <varname>ExecStop=</varname> or
472 <varname>ExecReload=</varname> settings of service units are
473 control processes. Note that there is only one control
474 process per unit at a time, as only one state change is
475 executed at a time. For services of type
b8bde116 476 <varname>Type=forking</varname>, the initial process started
af7424af
LP
477 by the manager for <varname>ExecStart=</varname> is a
478 control process, while the process ultimately forked off by
479 that one is then considered the main process of the unit (if
480 it can be determined). This is different for service units
481 of other types, where the process forked off by the manager
482 for <varname>ExecStart=</varname> is always the main process
b8bde116
JE
483 itself. A service unit consists of zero or one main process,
484 zero or one control process plus any number of additional
af7424af 485 processes. Not all unit types manage processes of these
b8bde116 486 types however. For example, for mount units, control processes
af7424af 487 are defined (which are the invocations of
d31dd62b
FB
488 <filename>&MOUNT_PATH;</filename> and
489 <filename>&UMOUNT_PATH;</filename>), but no main process
af7424af
LP
490 is defined. If omitted, defaults to
491 <option>all</option>.</para>
4a6022f0
ZJS
492 </listitem>
493
494 </varlistentry>
495
496 <varlistentry>
497 <term><option>-s</option></term>
498 <term><option>--signal=</option></term>
499
500 <listitem>
501 <para>When used with <command>kill</command>, choose which
502 signal to send to selected processes. Must be one of the
b938cb90 503 well-known signal specifiers such as <constant>SIGTERM</constant>, <constant>SIGINT</constant> or
7b870f60 504 <constant>SIGSTOP</constant>. If omitted, defaults to
4a6022f0
ZJS
505 <option>SIGTERM</option>.</para>
506 </listitem>
507 </varlistentry>
508
8c8208cb
LP
509 <varlistentry>
510 <term><option>--what=</option></term>
511
512 <listitem>
513 <para>Select what type of per-unit resources to remove when the <command>clean</command> command is
514 invoked, see below. Takes one of <constant>configuration</constant>, <constant>state</constant>,
515 <constant>cache</constant>, <constant>logs</constant>, <constant>runtime</constant> to select the
516 type of resource. This option may be specified more than once, in which case all specified resource
517 types are removed. Also accepts the special value <constant>all</constant> as a shortcut for
518 specifiying all five resource types. If this option is not specified defaults to the combination of
519 <constant>cache</constant> and <constant>runtime</constant>, i.e. the two kinds of resources that
520 are generally considered to be redundant and can be reconstructed on next invocation.</para>
521 </listitem>
522 </varlistentry>
523
4a6022f0
ZJS
524 <varlistentry>
525 <term><option>-f</option></term>
526 <term><option>--force</option></term>
527
528 <listitem>
529 <para>When used with <command>enable</command>, overwrite
530 any existing conflicting symlinks.</para>
531
39c38ce1
DC
532 <para>When used with <command>edit</command>, create all of the
533 specified units which do not already exist.</para>
534
924e44b4
LP
535 <para>When used with <command>halt</command>, <command>poweroff</command>, <command>reboot</command> or
536 <command>kexec</command>, execute the selected operation without shutting down all units. However, all
537 processes will be killed forcibly and all file systems are unmounted or remounted read-only. This is hence a
538 drastic but relatively safe option to request an immediate reboot. If <option>--force</option> is specified
539 twice for these operations (with the exception of <command>kexec</command>), they will be executed
540 immediately, without terminating any processes or unmounting any file systems. Warning: specifying
541 <option>--force</option> twice with any of these operations might result in data loss. Note that when
542 <option>--force</option> is specified twice the selected operation is executed by
543 <command>systemctl</command> itself, and the system manager is not contacted. This means the command should
6324a8a7 544 succeed even when the system manager has crashed.</para>
4a6022f0
ZJS
545 </listitem>
546 </varlistentry>
547
9ef15026
JS
548 <varlistentry>
549 <term><option>--message=</option></term>
550
551 <listitem>
6324a8a7
LP
552 <para>When used with <command>halt</command>, <command>poweroff</command> or <command>reboot</command>, set a
553 short message explaining the reason for the operation. The message will be logged together with the default
554 shutdown message.</para>
9ef15026
JS
555 </listitem>
556 </varlistentry>
557
57ab2eab
JS
558 <varlistentry>
559 <term><option>--now</option></term>
560
561 <listitem>
562 <para>When used with <command>enable</command>, the units
563 will also be started. When used with <command>disable</command> or
564 <command>mask</command>, the units will also be stopped. The start
565 or stop operation is only carried out when the respective enable or
566 disable operation has been successful.</para>
567 </listitem>
568 </varlistentry>
569
4a6022f0
ZJS
570 <varlistentry>
571 <term><option>--root=</option></term>
572
573 <listitem>
574 <para>When used with
575 <command>enable</command>/<command>disable</command>/<command>is-enabled</command>
9b914a9d
ZJS
576 (and related commands), use the specified root path when looking for unit
577 files. If this option is present, <command>systemctl</command> will operate on
578 the file system directly, instead of communicating with the <command>systemd</command>
579 daemon to carry out changes.</para>
4a6022f0
ZJS
580 </listitem>
581
582 </varlistentry>
583
584 <varlistentry>
585 <term><option>--runtime</option></term>
586
587 <listitem>
1830ac51
MB
588 <para>When used with <command>enable</command>,
589 <command>disable</command>, <command>edit</command>,
590 (and related commands), make changes only temporarily, so
591 that they are lost on the next reboot. This will have the
592 effect that changes are not made in subdirectories of
593 <filename>/etc</filename> but in <filename>/run</filename>,
594 with identical immediate effects, however, since the latter
4a6022f0 595 is lost on reboot, the changes are lost too.</para>
a330b376 596
1830ac51
MB
597 <para>Similarly, when used with
598 <command>set-property</command>, make changes only
599 temporarily, so that they are lost on the next
600 reboot.</para>
4a6022f0
ZJS
601 </listitem>
602 </varlistentry>
603
d309c1c3
LP
604 <varlistentry>
605 <term><option>--preset-mode=</option></term>
606
607 <listitem>
608 <para>Takes one of <literal>full</literal> (the default),
609 <literal>enable-only</literal>,
8d0e0ddd 610 <literal>disable-only</literal>. When used with the
d309c1c3 611 <command>preset</command> or <command>preset-all</command>
8d0e0ddd 612 commands, controls whether units shall be disabled and
d309c1c3
LP
613 enabled according to the preset rules, or only enabled, or
614 only disabled.</para>
615 </listitem>
616 </varlistentry>
617
4a6022f0
ZJS
618 <varlistentry>
619 <term><option>-n</option></term>
620 <term><option>--lines=</option></term>
621
622 <listitem>
d5bf4f9b
LW
623 <para>When used with <command>status</command>, controls the number of journal lines to show, counting from
624 the most recent ones. Takes a positive integer argument, or 0 to disable journal output. Defaults to
4a6022f0
ZJS
625 10.</para>
626 </listitem>
627 </varlistentry>
628
629 <varlistentry>
630 <term><option>-o</option></term>
631 <term><option>--output=</option></term>
632
633 <listitem>
7b870f60 634 <para>When used with <command>status</command>, controls the
4a6022f0 635 formatting of the journal entries that are shown. For the
7b870f60 636 available choices, see
4a6022f0
ZJS
637 <citerefentry><refentrytitle>journalctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
638 Defaults to <literal>short</literal>.</para>
639 </listitem>
640 </varlistentry>
641
5bdf2243
JJ
642 <varlistentry>
643 <term><option>--firmware-setup</option></term>
644
645 <listitem>
97af80c5
LP
646 <para>When used with the <command>reboot</command> command, indicate to the system's firmware to reboot into
647 the firmware setup interface. Note that this functionality is not available on all systems.</para>
648 </listitem>
649 </varlistentry>
650
651 <varlistentry>
652 <term><option>--boot-loader-menu=</option></term>
653
654 <listitem>
655 <para>When used with the <command>reboot</command> command, indicate to the system's boot loader to show the
656 boot loader menu on the following boot. Takes a time value as parameter — indicating the menu time-out. Pass
657 zero in order to disable the menu time-out. Note that not all boot loaders support this
658 functionality.</para>
659 </listitem>
660 </varlistentry>
661
662 <varlistentry>
663 <term><option>--boot-loader-entry=</option></term>
664
665 <listitem>
666 <para>When used with the <command>reboot</command> command, indicate to the system's boot loader to boot into
667 a specific boot loader entry on the following boot. Takes a boot loader entry identifier as argument, or
668 <literal>help</literal> in order to list available entries. Note that not all boot loaders support this
669 functionality.</para>
5bdf2243
JJ
670 </listitem>
671 </varlistentry>
672
5d0c05e5
LN
673 <varlistentry>
674 <term><option>--plain</option></term>
675
676 <listitem>
7b870f60 677 <para>When used with <command>list-dependencies</command>,
831d3dc8 678 <command>list-units</command> or <command>list-machines</command>,
a20e43c0
MT
679 the output is printed as a list instead of a tree, and the bullet
680 circles are omitted.</para>
5d0c05e5
LN
681 </listitem>
682 </varlistentry>
683
4f50d2ef
ZJS
684 <xi:include href="user-system-options.xml" xpointer="host" />
685 <xi:include href="user-system-options.xml" xpointer="machine" />
686
12f15e59
ZJS
687 <xi:include href="standard-options.xml" xpointer="no-pager" />
688 <xi:include href="standard-options.xml" xpointer="no-legend" />
dfdebb1b
ZJS
689 <xi:include href="standard-options.xml" xpointer="help" />
690 <xi:include href="standard-options.xml" xpointer="version" />
4a6022f0
ZJS
691 </variablelist>
692 </refsect1>
693
694 <refsect1>
695 <title>Commands</title>
696
697 <para>The following commands are understood:</para>
698
27722f96
LN
699 <refsect2>
700 <title>Unit Commands</title>
4a6022f0 701
27722f96
LN
702 <variablelist>
703 <varlistentry>
e92b3655 704 <term><command>list-units</command> <optional><replaceable>PATTERN</replaceable>…</optional></term>
4a6022f0 705
27722f96 706 <listitem>
2cdbbc9a
LP
707 <para>List units that <command>systemd</command> currently has in memory. This includes units that are
708 either referenced directly or through a dependency, units that are pinned by applications programmatically,
709 or units that were active in the past and have failed. By default only units which are active, have pending
710 jobs, or have failed are shown; this can be changed with option <option>--all</option>. If one or more
05a98afd
LP
711 <replaceable>PATTERN</replaceable>s are specified, only units matching one of them are shown. The units
712 that are shown are additionally filtered by <option>--type=</option> and <option>--state=</option> if those
713 options are specified.</para>
991f2a39 714
6fdbb3c8
ZJS
715 <para>Produces output similar to
716 <programlisting> UNIT LOAD ACTIVE SUB DESCRIPTION
717 sys-module-fuse.device loaded active plugged /sys/module/fuse
718 -.mount loaded active mounted Root Mount
719 boot-efi.mount loaded active mounted /boot/efi
720 systemd-journald.service loaded active running Journal Service
721 systemd-logind.service loaded active running Login Service
f07b5489
ZJS
722● user@1000.service loaded failed failed User Manager for UID 1000
723
6fdbb3c8
ZJS
724 systemd-tmpfiles-clean.timer loaded active waiting Daily Cleanup of Temporary Directories
725
726LOAD = Reflects whether the unit definition was properly loaded.
727ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
728SUB = The low-level unit activation state, values depend on unit type.
729
730123 loaded units listed. Pass --all to see loaded but inactive units, too.
731To show all installed unit files use 'systemctl list-unit-files'.
732 </programlisting>
733 The header and the last unit of a given type are underlined if the
734 terminal supports that. A colored dot is shown next to services which
735 were masked, not found, or otherwise failed.</para>
736
443dee9d 737 <para>The LOAD column shows the load state, one of <constant>loaded</constant>,
c4555ad8
LP
738 <constant>not-found</constant>, <constant>bad-setting</constant>, <constant>error</constant>,
739 <constant>masked</constant>. The ACTIVE columns shows the general unit state, one of
740 <constant>active</constant>, <constant>reloading</constant>, <constant>inactive</constant>,
741 <constant>failed</constant>, <constant>activating</constant>, <constant>deactivating</constant>. The SUB
742 column shows the unit-type-specific detailed state of the unit, possible values vary by unit type. The list
743 of possible LOAD, ACTIVE, and SUB states is not constant and new systemd releases may both add and remove
744 values. <programlisting>systemctl --state=help</programlisting> command maybe be used to display the
745 current set of possible values.</para>
6fdbb3c8 746
27722f96
LN
747 <para>This is the default command.</para>
748 </listitem>
749 </varlistentry>
991f2a39 750
27722f96 751 <varlistentry>
e92b3655 752 <term><command>list-sockets</command> <optional><replaceable>PATTERN</replaceable>…</optional></term>
27722f96
LN
753
754 <listitem>
2cdbbc9a
LP
755 <para>List socket units currently in memory, ordered by listening address. If one or more
756 <replaceable>PATTERN</replaceable>s are specified, only socket units matching one of them are
d8fba7c6 757 shown. Produces output similar to
27722f96 758 <programlisting>
991f2a39
ZJS
759LISTEN UNIT ACTIVATES
760/dev/initctl systemd-initctl.socket systemd-initctl.service
1eecafb8 761
991f2a39
ZJS
762[::]:22 sshd.socket sshd.service
763kobject-uevent 1 systemd-udevd-kernel.socket systemd-udevd.service
764
9fccdb0f 7655 sockets listed.</programlisting>
27722f96
LN
766 Note: because the addresses might contains spaces, this output
767 is not suitable for programmatic consumption.
768 </para>
769
2cdbbc9a 770 <para>Also see <option>--show-types</option>, <option>--all</option>, and <option>--state=</option>.</para>
27722f96
LN
771 </listitem>
772 </varlistentry>
773
cbb76c29 774 <varlistentry>
e92b3655 775 <term><command>list-timers</command> <optional><replaceable>PATTERN</replaceable>…</optional></term>
cbb76c29
LP
776
777 <listitem>
2cdbbc9a
LP
778 <para>List timer units currently in memory, ordered by the time they elapse next. If one or more
779 <replaceable>PATTERN</replaceable>s are specified, only units matching one of them are shown.
3c3fff44 780 Produces output similar to
ccdda955
MS
781 <programlisting>
782NEXT LEFT LAST PASSED UNIT ACTIVATES
783n/a n/a Thu 2017-02-23 13:40:29 EST 3 days ago ureadahead-stop.timer ureadahead-stop.service
784Sun 2017-02-26 18:55:42 EST 1min 14s left Thu 2017-02-23 13:54:44 EST 3 days ago systemd-tmpfiles-clean.timer systemd-tmpfiles-clean.service
785Sun 2017-02-26 20:37:16 EST 1h 42min left Sun 2017-02-26 11:56:36 EST 6h ago apt-daily.timer apt-daily.service
786Sun 2017-02-26 20:57:49 EST 2h 3min left Sun 2017-02-26 11:56:36 EST 6h ago snapd.refresh.timer snapd.refresh.service
787 </programlisting>
d8fba7c6 788 </para>
cbb76c29 789
ccdda955
MS
790 <para><emphasis>NEXT</emphasis> shows the next time the timer will run.</para>
791 <para><emphasis>LEFT</emphasis> shows how long till the next time the timer runs.</para>
792 <para><emphasis>LAST</emphasis> shows the last time the timer ran.</para>
7456fa02 793 <para><emphasis>PASSED</emphasis> shows how long has passed since the timer last ran.</para>
ccdda955 794 <para><emphasis>UNIT</emphasis> shows the name of the timer</para>
785889e5 795 <para><emphasis>ACTIVATES</emphasis> shows the name the service the timer activates when it runs.</para>
ccdda955 796
2cdbbc9a 797 <para>Also see <option>--all</option> and <option>--state=</option>.</para>
cbb76c29
LP
798 </listitem>
799 </varlistentry>
800
27722f96 801 <varlistentry>
1eecafb8 802 <term><command>start <replaceable>PATTERN</replaceable>…</command></term>
27722f96
LN
803
804 <listitem>
805 <para>Start (activate) one or more units specified on the
806 command line.</para>
e3e0314b 807
2cdbbc9a
LP
808 <para>Note that glob patterns operate on the set of primary names of units currently in memory. Units which
809 are not active and are not in a failed state usually are not in memory, and will not be matched by any
1f00eded
LP
810 pattern. In addition, in case of instantiated units, systemd is often unaware of the instance name until
811 the instance has been started. Therefore, using glob patterns with <command>start</command> has limited
812 usefulness. Also, secondary alias names of units are not considered.</para>
27722f96
LN
813 </listitem>
814 </varlistentry>
815 <varlistentry>
1eecafb8 816 <term><command>stop <replaceable>PATTERN</replaceable>…</command></term>
27722f96
LN
817
818 <listitem>
4f0acdb3
ZJS
819 <para>Stop (deactivate) one or more units specified on the command line.</para>
820
821 <para>This command will fail if the unit does exist or if stopping of the unit is prohibited (see
822 <varname>RefuseManualStop=</varname> in
823 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>).
824 It will <emphasis>not</emphasis> fail if any of the commands configured to stop the unit
825 (<varname>ExecStop=</varname>, etc.) fail, because the manager will still forcibly terminate the
826 unit.</para>
27722f96
LN
827 </listitem>
828 </varlistentry>
829 <varlistentry>
1eecafb8 830 <term><command>reload <replaceable>PATTERN</replaceable>…</command></term>
27722f96
LN
831
832 <listitem>
833 <para>Asks all units listed on the command line to reload
834 their configuration. Note that this will reload the
835 service-specific configuration, not the unit configuration
836 file of systemd. If you want systemd to reload the
79640424 837 configuration file of a unit, use the
27722f96
LN
838 <command>daemon-reload</command> command. In other words:
839 for the example case of Apache, this will reload Apache's
840 <filename>httpd.conf</filename> in the web server, not the
841 <filename>apache.service</filename> systemd unit
842 file.</para>
843
844 <para>This command should not be confused with the
d0a3fb75 845 <command>daemon-reload</command> command.</para>
27722f96
LN
846 </listitem>
847
848 </varlistentry>
849 <varlistentry>
1eecafb8 850 <term><command>restart <replaceable>PATTERN</replaceable>…</command></term>
27722f96
LN
851
852 <listitem>
c4f2aaa4
LP
853 <para>Stop and then start one or more units specified on the command line. If the units are not running
854 yet, they will be started.</para>
855
856 <para>Note that restarting a unit with this command does not necessarily flush out all of the unit's
857 resources before it is started again. For example, the per-service file descriptor storage facility (see
8b247b43 858 <varname>FileDescriptorStoreMax=</varname> in
c4f2aaa4
LP
859 <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>) will
860 remain intact as long as the unit has a job pending, and is only cleared when the unit is fully stopped and
861 no jobs are pending anymore. If it is intended that the file descriptor store is flushed out, too, during a
862 restart operation an explicit <command>systemctl stop</command> command followed by <command>systemctl
863 start</command> should be issued.</para>
27722f96
LN
864 </listitem>
865 </varlistentry>
866 <varlistentry>
1eecafb8 867 <term><command>try-restart <replaceable>PATTERN</replaceable>…</command></term>
27722f96
LN
868
869 <listitem>
6539dd7c 870 <para>Stop and then start one or more units specified on the
871 command line if the units are running. This does nothing
872 if units are not running.</para>
2fcee0a5
LP
873 <!-- Note that we don't document condrestart here, as that is just compatibility support, and we generally
874 don't document that. -->
27722f96
LN
875 </listitem>
876 </varlistentry>
877 <varlistentry>
1eecafb8 878 <term><command>reload-or-restart <replaceable>PATTERN</replaceable>…</command></term>
27722f96
LN
879
880 <listitem>
ff946d82
LP
881 <para>Reload one or more units if they support it. If not, stop and then start them instead. If the units
882 are not running yet, they will be started.</para>
27722f96
LN
883 </listitem>
884 </varlistentry>
885 <varlistentry>
1eecafb8 886 <term><command>try-reload-or-restart <replaceable>PATTERN</replaceable>…</command></term>
27722f96
LN
887
888 <listitem>
ff946d82
LP
889 <para>Reload one or more units if they support it. If not, stop and then start them instead. This does
890 nothing if the units are not running.</para>
2fcee0a5
LP
891 <!-- Note that we don't document force-reload here, as that is just compatibility support, and we generally
892 don't document that. -->
27722f96
LN
893 </listitem>
894 </varlistentry>
895 <varlistentry>
da5e955f 896 <term><command>isolate <replaceable>UNIT</replaceable></command></term>
27722f96
LN
897
898 <listitem>
26adf774
ZJS
899 <para>Start the unit specified on the command line and its dependencies
900 and stop all others, unless they have
901 <option>IgnoreOnIsolate=yes</option> (see
902 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>).
903 If a unit name with no extension is given, an extension of
507e28d8 904 <literal>.target</literal> will be assumed.</para>
27722f96
LN
905
906 <para>This is similar to changing the runlevel in a
907 traditional init system. The <command>isolate</command>
908 command will immediately stop processes that are not enabled
909 in the new unit, possibly including the graphical
910 environment or terminal you are currently using.</para>
911
912 <para>Note that this is allowed only on units where
913 <option>AllowIsolate=</option> is enabled. See
914 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
915 for details.</para>
916 </listitem>
917 </varlistentry>
918 <varlistentry>
1eecafb8 919 <term><command>kill <replaceable>PATTERN</replaceable>…</command></term>
27722f96
LN
920
921 <listitem>
922 <para>Send a signal to one or more processes of the
923 unit. Use <option>--kill-who=</option> to select which
0088d631
LP
924 process to kill. Use <option>--signal=</option> to select
925 the signal to send.</para>
27722f96
LN
926 </listitem>
927 </varlistentry>
8c8208cb
LP
928 <varlistentry>
929 <term><command>clean <replaceable>PATTERN</replaceable>…</command></term>
930
931 <listitem>
932 <para>Remove the configuration, state, cache, logs or runtime data of the specified units. Use
933 <option>--what=</option> to select which kind of resource to remove. For service units this may
934 be used to remove the directories configured with <varname>ConfigurationDirectory=</varname>,
935 <varname>StateDirectory=</varname>, <varname>CacheDirectory=</varname>,
936 <varname>LogsDirectory=</varname> and <varname>RuntimeDirectory=</varname>, see
937 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>
938 for details. For timer units this may be used to clear out the persistent timestamp data if
939 <varname>Persistent=</varname> is used and <option>--what=state</option> is selected, see
940 <citerefentry><refentrytitle>systemd.timer</refentrytitle><manvolnum>5</manvolnum></citerefentry>. This
941 command only applies to units that use either of these settings. If <option>--what=</option> is
942 not specified, both the cache and runtime data are removed (as these two types of data are
943 generally redundant and reproducible on the next invocation of the unit).</para>
944 </listitem>
945 </varlistentry>
27722f96 946 <varlistentry>
1eecafb8 947 <term><command>is-active <replaceable>PATTERN</replaceable>…</command></term>
27722f96
LN
948
949 <listitem>
950 <para>Check whether any of the specified units are active
6db27428
ZJS
951 (i.e. running). Returns an exit code
952 <constant>0</constant> if at least one is active, or
953 non-zero otherwise. Unless <option>--quiet</option> is
954 specified, this will also print the current unit state to
955 standard output.</para>
27722f96
LN
956 </listitem>
957 </varlistentry>
958 <varlistentry>
1eecafb8 959 <term><command>is-failed <replaceable>PATTERN</replaceable>…</command></term>
27722f96
LN
960
961 <listitem>
6db27428
ZJS
962 <para>Check whether any of the specified units are in a
963 "failed" state. Returns an exit code
964 <constant>0</constant> if at least one has failed,
965 non-zero otherwise. Unless <option>--quiet</option> is
966 specified, this will also print the current unit state to
967 standard output.</para>
27722f96
LN
968 </listitem>
969 </varlistentry>
970 <varlistentry>
1eecafb8 971 <term><command>status</command> <optional><replaceable>PATTERN</replaceable>…|<replaceable>PID</replaceable>…]</optional></term>
27722f96
LN
972
973 <listitem>
974 <para>Show terse runtime status information about one or
975 more units, followed by most recent log data from the
8fcf784d 976 journal. If no units are specified, show system status. If
b8bde116 977 combined with <option>--all</option>, also show the status of
8fcf784d
LP
978 all units (subject to limitations specified with
979 <option>-t</option>). If a PID is passed, show information
980 about the unit the process belongs to.</para>
27722f96
LN
981
982 <para>This function is intended to generate human-readable
e213d1a3 983 output. If you are looking for computer-parsable output,
b938cb90 984 use <command>show</command> instead. By default, this
e213d1a3 985 function only shows 10 lines of output and ellipsizes
4559a721 986 lines to fit in the terminal window. This can be changed
e213d1a3
ZJS
987 with <option>--lines</option> and <option>--full</option>,
988 see above. In addition, <command>journalctl
989 --unit=<replaceable>NAME</replaceable></command> or
990 <command>journalctl
991 --user-unit=<replaceable>NAME</replaceable></command> use
992 a similar filter for messages and might be more
993 convenient.
994 </para>
ab8864eb 995
f95b0be7 996 <para>systemd implicitly loads units as necessary, so just running the <command>status</command> will
ab8864eb
MS
997 attempt to load a file. The command is thus not useful for determining if something was already loaded or
998 not. The units may possibly also be quickly unloaded after the operation is completed if there's no reason
999 to keep it in memory thereafter.
1000 </para>
1001
1002 <example>
1003 <title>Example output from systemctl status </title>
1004
1005 <programlisting>$ systemctl status bluetooth
1006● bluetooth.service - Bluetooth service
83ddf5d3 1007 Loaded: loaded (/usr/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled)
ab8864eb
MS
1008 Active: active (running) since Wed 2017-01-04 13:54:04 EST; 1 weeks 0 days ago
1009 Docs: man:bluetoothd(8)
1010 Main PID: 930 (bluetoothd)
1011 Status: "Running"
1012 Tasks: 1
1013 Memory: 648.0K
1014 CPU: 435ms
1015 CGroup: /system.slice/bluetooth.service
1016 └─930 /usr/lib/bluetooth/bluetoothd
1017
1018Jan 12 10:46:45 example.com bluetoothd[8900]: Not enough free handles to register service
542ca7c9
DR
1019Jan 12 10:46:45 example.com bluetoothd[8900]: Current Time Service could not be registered
1020Jan 12 10:46:45 example.com bluetoothd[8900]: gatt-time-server: Input/output error (5)
ab8864eb
MS
1021</programlisting>
1022
1023 <para>The dot ("●") uses color on supported terminals to summarize the unit state at a glance. White
1024 indicates an <literal>inactive</literal> or <literal>deactivating</literal> state. Red indicates a
1025 <literal>failed</literal> or <literal>error</literal> state and green indicates an
1026 <literal>active</literal>, <literal>reloading</literal> or <literal>activating</literal> state.
1027 </para>
1028
1029 <para>The "Loaded:" line in the output will show <literal>loaded</literal> if the unit has been loaded into
1030 memory. Other possible values for "Loaded:" include: <literal>error</literal> if there was a problem
c4555ad8
LP
1031 loading it, <literal>not-found</literal> if not unit file was found for this unit,
1032 <literal>bad-setting</literal> if an essential unit file setting could not be parsed and
1033 <literal>masked</literal> if the unit file has been masked. Along with showing the path to the unit file,
1034 this line will also show the enablement state. Enabled commands start at boot. See the full table of
1035 possible enablement states — including the definition of <literal>masked</literal> — in the documentation
1036 for the <command>is-enabled</command> command.
ab8864eb
MS
1037 </para>
1038
1039 <para>The "Active:" line shows active state. The value is usually <literal>active</literal> or
1040 <literal>inactive</literal>. Active could mean started, bound, plugged in, etc depending on the unit type.
1041 The unit could also be in process of changing states, reporting a state of <literal>activating</literal> or
1042 <literal>deactivating</literal>. A special <literal>failed</literal> state is entered when the service
1043 failed in some way, such as a crash, exiting with an error code or timing out. If the failed state is
1044 entered the cause will be logged for later reference.</para>
1045 </example>
1046
27722f96
LN
1047 </listitem>
1048 </varlistentry>
1049 <varlistentry>
1eecafb8 1050 <term><command>show</command> <optional><replaceable>PATTERN</replaceable>…|<replaceable>JOB</replaceable>…</optional></term>
27722f96
LN
1051
1052 <listitem>
33d2308c
LP
1053 <para>Show properties of one or more units, jobs, or the manager itself. If no argument is specified,
1054 properties of the manager will be shown. If a unit name is specified, properties of the unit are shown, and
1055 if a job ID is specified, properties of the job are shown. By default, empty properties are suppressed. Use
1056 <option>--all</option> to show those too. To select specific properties to show, use
1057 <option>--property=</option>. This command is intended to be used whenever computer-parsable output is
1058 required. Use <command>status</command> if you are looking for formatted human-readable output.</para>
1059
1060 <para>Many properties shown by <command>systemctl show</command> map directly to configuration settings of
1061 the system and service manager and its unit files. Note that the properties shown by the command are
1062 generally more low-level, normalized versions of the original configuration settings and expose runtime
1063 state in addition to configuration. For example, properties shown for service units include the service's
1064 current main process identifier as <literal>MainPID</literal> (which is runtime state), and time settings
1065 are always exposed as properties ending in the <literal>…USec</literal> suffix even if a matching
1066 configuration options end in <literal>…Sec</literal>, because microseconds is the normalized time unit used
1067 by the system and service manager.</para>
27722f96
LN
1068 </listitem>
1069 </varlistentry>
e93c33d4 1070 <varlistentry>
1eecafb8 1071 <term><command>cat <replaceable>PATTERN</replaceable>…</command></term>
27722f96 1072
e93c33d4 1073 <listitem>
e4c0fbe5
ZJS
1074 <para>Show backing files of one or more units. Prints the
1075 "fragment" and "drop-ins" (source files) of units. Each
1076 file is preceded by a comment which includes the file
d4a48671
LW
1077 name. Note that this shows the contents of the backing files
1078 on disk, which may not match the system manager's
1079 understanding of these units if any unit files were
1080 updated on disk and the <command>daemon-reload</command>
1081 command wasn't issued since.</para>
e93c33d4
SL
1082 </listitem>
1083 </varlistentry>
27722f96 1084 <varlistentry>
fbf3283b 1085 <term><command>set-property <replaceable>UNIT</replaceable> <replaceable>PROPERTY</replaceable>=<replaceable>VALUE</replaceable>…</command></term>
27722f96
LN
1086
1087 <listitem>
1088 <para>Set the specified unit properties at runtime where
1089 this is supported. This allows changing configuration
3fde5f30 1090 parameter properties such as resource control settings at
27722f96 1091 runtime. Not all properties may be changed at runtime, but
3fde5f30
LP
1092 many resource control settings (primarily those in
1093 <citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>)
fbf3283b 1094 may. The changes are applied immediately, and stored on disk
27722f96 1095 for future boots, unless <option>--runtime</option> is
3fde5f30
LP
1096 passed, in which case the settings only apply until the
1097 next reboot. The syntax of the property assignment follows
27722f96
LN
1098 closely the syntax of assignments in unit files.</para>
1099
84f8e250 1100 <para>Example: <command>systemctl set-property foobar.service CPUWeight=200</command></para>
27722f96 1101
e9fd88f2
FB
1102 <para>If the specified unit appears to be inactive, the
1103 changes will be only stored on disk as described
1104 previously hence they will be effective when the unit will
1105 be started.</para>
1106
5b792edb
LP
1107 <para>Note that this command allows changing multiple properties at the same time, which is
1108 preferable over setting them individually.</para>
1109
1110 <para>Example: <command>systemctl set-property foobar.service CPUWeight=200 MemoryMax=2G IPAccounting=yes</command></para>
1111
1112 <para>Like with unit file configuration settings, assigning an empty setting usually resets a
1113 property to its defaults.</para>
1114
1115 <para>Example: <command>systemctl set-property avahi-daemon.service IPAddressDeny=</command></para>
27722f96
LN
1116 </listitem>
1117 </varlistentry>
1118
1119 <varlistentry>
1eecafb8 1120 <term><command>help <replaceable>PATTERN</replaceable>…|<replaceable>PID</replaceable>…</command></term>
27722f96
LN
1121
1122 <listitem>
1123 <para>Show manual pages for one or more units, if
1124 available. If a PID is given, the manual pages for the unit
1125 the process belongs to are shown.</para>
1126 </listitem>
1127 </varlistentry>
1128
1129 <varlistentry>
1eecafb8 1130 <term><command>reset-failed [<replaceable>PATTERN</replaceable>…]</command></term>
27722f96
LN
1131
1132 <listitem>
ff946d82
LP
1133 <para>Reset the <literal>failed</literal> state of the specified units, or if no unit name is passed, reset
1134 the state of all units. When a unit fails in some way (i.e. process exiting with non-zero error code,
1135 terminating abnormally or timing out), it will automatically enter the <literal>failed</literal> state and
1136 its exit code and status is recorded for introspection by the administrator until the service is
1137 stopped/re-started or reset with this command.</para>
860cc6df
LP
1138
1139 <para>In addition to resetting the <literal>failed</literal> state of a unit it also resets various other
1140 per-unit properties: the start rate limit counter of all unit types is reset to zero, as is the restart
1141 counter of service units. Thus, if a unit's start limit (as configured with
1142 <varname>StartLimitIntervalSec=</varname>/<varname>StartLimitBurst=</varname>) is hit and the unit refuses
1143 to be started again, use this command to make it startable again.</para>
27722f96
LN
1144 </listitem>
1145 </varlistentry>
1146
1147 <varlistentry>
f6375e83
ZJS
1148 <term>
1149 <command>list-dependencies</command>
da5e955f 1150 <optional><replaceable>UNIT</replaceable></optional>
f6375e83 1151 </term>
27722f96
LN
1152
1153 <listitem>
f6375e83
ZJS
1154 <para>Shows units required and wanted by the specified
1155 unit. This recursively lists units following the
1156 <varname>Requires=</varname>,
f6375e83 1157 <varname>Requisite=</varname>,
fb30c438 1158 <varname>ConsistsOf=</varname>,
f6375e83
ZJS
1159 <varname>Wants=</varname>, <varname>BindsTo=</varname>
1160 dependencies. If no unit is specified,
1161 <filename>default.target</filename> is implied.</para>
1162
1163 <para>By default, only target units are recursively
1164 expanded. When <option>--all</option> is passed, all other
1165 units are recursively expanded as well.</para>
1166
1167 <para>Options <option>--reverse</option>,
1168 <option>--after</option>, <option>--before</option>
1169 may be used to change what types of dependencies
1170 are shown.</para>
ff5bd14b
LP
1171
1172 <para>Note that this command only lists units currently loaded into memory by the service manager. In
1173 particular, this command is not suitable to get a comprehensive list at all reverse dependencies on a
1174 specific unit, as it won't list the dependencies declared by units currently not loaded.</para>
27722f96
LN
1175 </listitem>
1176 </varlistentry>
1177 </variablelist>
1178 </refsect2>
1179
1180 <refsect2>
1181 <title>Unit File Commands</title>
1182
1183 <variablelist>
1184 <varlistentry>
e92b3655 1185 <term><command>list-unit-files</command> <optional><replaceable>PATTERN…</replaceable></optional></term>
27722f96
LN
1186
1187 <listitem>
3990961d
LP
1188 <para>List unit files installed on the system, in combination with their enablement state (as reported by
1189 <command>is-enabled</command>). If one or more <replaceable>PATTERN</replaceable>s are specified, only unit
1190 files whose name matches one of them are shown (patterns matching unit file system paths are not
1191 supported).</para>
27722f96
LN
1192 </listitem>
1193 </varlistentry>
1194
1195 <varlistentry>
da5e955f 1196 <term><command>enable <replaceable>UNIT</replaceable>…</command></term>
1eecafb8 1197 <term><command>enable <replaceable>PATH</replaceable>…</command></term>
27722f96
LN
1198
1199 <listitem>
3990961d
LP
1200 <para>Enable one or more units or unit instances. This will create a set of symlinks, as encoded in the
1201 <literal>[Install]</literal> sections of the indicated unit files. After the symlinks have been created,
1202 the system manager configuration is reloaded (in a way equivalent to <command>daemon-reload</command>), in
1203 order to ensure the changes are taken into account immediately. Note that this does
1204 <emphasis>not</emphasis> have the effect of also starting any of the units being enabled. If this is
1205 desired, combine this command with the <option>--now</option> switch, or invoke <command>start</command>
1206 with appropriate arguments later. Note that in case of unit instance enablement (i.e. enablement of units of
1207 the form <filename>foo@bar.service</filename>), symlinks named the same as instances are created in the
2dd67817 1208 unit configuration directory, however they point to the single template unit file they are instantiated
3990961d
LP
1209 from.</para>
1210
93f07c87
ZJS
1211 <para>This command expects either valid unit names (in which case various unit file directories are
1212 automatically searched for unit files with appropriate names), or absolute paths to unit files (in which
1213 case these files are read directly). If a specified unit file is located outside of the usual unit file
1214 directories, an additional symlink is created, linking it into the unit configuration path, thus ensuring
2f3828e5
ZJS
1215 it is found when requested by commands such as <command>start</command>. The file system where the linked
1216 unit files are located must be accessible when systemd is started (e.g. anything underneath
1217 <filename>/home</filename> or <filename>/var</filename> is not allowed, unless those directories are
1218 located on the root file system).</para>
3990961d
LP
1219
1220 <para>This command will print the file system operations executed. This output may be suppressed by passing
1221 <option>--quiet</option>.
27722f96
LN
1222 </para>
1223
3990961d
LP
1224 <para>Note that this operation creates only the symlinks suggested in the <literal>[Install]</literal>
1225 section of the unit files. While this command is the recommended way to manipulate the unit configuration
1226 directory, the administrator is free to make additional changes manually by placing or removing symlinks
1227 below this directory. This is particularly useful to create configurations that deviate from the suggested
1228 default installation. In this case, the administrator must make sure to invoke
1229 <command>daemon-reload</command> manually as necessary, in order to ensure the changes are taken into
1230 account.
27722f96
LN
1231 </para>
1232
3990961d
LP
1233 <para>Enabling units should not be confused with starting (activating) units, as done by the
1234 <command>start</command> command. Enabling and starting units is orthogonal: units may be enabled without
1235 being started and started without being enabled. Enabling simply hooks the unit into various suggested
1236 places (for example, so that the unit is automatically started on boot or when a particular kind of
1237 hardware is plugged in). Starting actually spawns the daemon process (in case of service units), or binds
1238 the socket (in case of socket units), and so on.</para>
1239
1240 <para>Depending on whether <option>--system</option>, <option>--user</option>, <option>--runtime</option>,
1241 or <option>--global</option> is specified, this enables the unit for the system, for the calling user only,
1d82e6b3
AJ
1242 for only this boot of the system, or for all future logins of all users. Note that in the last case, no
1243 systemd daemon configuration is reloaded.</para>
3990961d
LP
1244
1245 <para>Using <command>enable</command> on masked units is not supported and results in an error.</para>
27722f96
LN
1246 </listitem>
1247 </varlistentry>
1248
1249 <varlistentry>
da5e955f 1250 <term><command>disable <replaceable>UNIT</replaceable>…</command></term>
27722f96
LN
1251
1252 <listitem>
3990961d
LP
1253 <para>Disables one or more units. This removes all symlinks to the unit files backing the specified units
1254 from the unit configuration directory, and hence undoes any changes made by <command>enable</command> or
1255 <command>link</command>. Note that this removes <emphasis>all</emphasis> symlinks to matching unit files,
1256 including manually created symlinks, and not just those actually created by <command>enable</command> or
1257 <command>link</command>. Note that while <command>disable</command> undoes the effect of
1258 <command>enable</command>, the two commands are otherwise not symmetric, as <command>disable</command> may
1259 remove more symlinks than a prior <command>enable</command> invocation of the same unit created.</para>
1260
1261 <para>This command expects valid unit names only, it does not accept paths to unit files.</para>
1262
1263 <para>In addition to the units specified as arguments, all units are disabled that are listed in the
1264 <varname>Also=</varname> setting contained in the <literal>[Install]</literal> section of any of the unit
1265 files being operated on.</para>
1266
1267 <para>This command implicitly reloads the system manager configuration after completing the operation. Note
1268 that this command does not implicitly stop the units that are being disabled. If this is desired, either
1269 combine this command with the <option>--now</option> switch, or invoke the <command>stop</command> command
1270 with appropriate arguments later.</para>
1271
1272 <para>This command will print information about the file system operations (symlink removals)
1273 executed. This output may be suppressed by passing <option>--quiet</option>.
27722f96
LN
1274 </para>
1275
3990961d
LP
1276 <para>This command honors <option>--system</option>, <option>--user</option>, <option>--runtime</option>
1277 and <option>--global</option> in a similar way as <command>enable</command>.</para>
27722f96
LN
1278 </listitem>
1279 </varlistentry>
1280
b619ec8f 1281 <varlistentry>
da5e955f 1282 <term><command>reenable <replaceable>UNIT</replaceable>…</command></term>
b619ec8f
LP
1283
1284 <listitem>
3990961d
LP
1285 <para>Reenable one or more units, as specified on the command line. This is a combination of
1286 <command>disable</command> and <command>enable</command> and is useful to reset the symlinks a unit file is
d903a892 1287 enabled with to the defaults configured in its <literal>[Install]</literal> section. This command expects
1288 a unit name only, it does not accept paths to unit files.</para>
b619ec8f
LP
1289 </listitem>
1290 </varlistentry>
1291
1292 <varlistentry>
da5e955f 1293 <term><command>preset <replaceable>UNIT</replaceable>…</command></term>
b619ec8f
LP
1294
1295 <listitem>
39207373
ZJS
1296 <para>Reset the enable/disable status one or more unit files, as specified on
1297 the command line, to the defaults configured in the preset policy files. This
1298 has the same effect as <command>disable</command> or
1299 <command>enable</command>, depending how the unit is listed in the preset
1300 files.</para>
b619ec8f 1301
39207373
ZJS
1302 <para>Use <option>--preset-mode=</option> to control whether units shall be
1303 enabled and disabled, or only enabled, or only disabled.</para>
1304
1305 <para>If the unit carries no install information, it will be silently ignored
da5e955f 1306 by this command. <replaceable>UNIT</replaceable> must be the real unit name,
d923e42e 1307 any alias names are ignored silently.</para>
b619ec8f 1308
39207373 1309 <para>For more information on the preset policy format, see
b619ec8f 1310 <citerefentry><refentrytitle>systemd.preset</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
39207373 1311 For more information on the concept of presets, please consult the
28a0ad81 1312 <ulink url="https://www.freedesktop.org/wiki/Software/systemd/Preset">Preset</ulink>
b619ec8f
LP
1313 document.</para>
1314 </listitem>
1315 </varlistentry>
1316
1317 <varlistentry>
1318 <term><command>preset-all</command></term>
1319
1320 <listitem>
1321 <para>Resets all installed unit files to the defaults
1322 configured in the preset policy file (see above).</para>
1323
1324 <para>Use <option>--preset-mode=</option> to control
1325 whether units shall be enabled and disabled, or only
1326 enabled, or only disabled.</para>
1327 </listitem>
1328 </varlistentry>
1329
27722f96 1330 <varlistentry>
da5e955f 1331 <term><command>is-enabled <replaceable>UNIT</replaceable>…</command></term>
27722f96
LN
1332
1333 <listitem>
1334 <para>Checks whether any of the specified unit files are
171754aa
ZJS
1335 enabled (as with <command>enable</command>). Returns an
1336 exit code of 0 if at least one is enabled, non-zero
1337 otherwise. Prints the current enable status (see table).
1338 To suppress this output, use <option>--quiet</option>.
3b3557c4 1339 To show installation targets, use <option>--full</option>.
171754aa
ZJS
1340 </para>
1341
1342 <table>
1343 <title>
1344 <command>is-enabled</command> output
1345 </title>
1346
1347 <tgroup cols='3'>
1348 <thead>
1349 <row>
94f099d8
LP
1350 <entry>Name</entry>
1351 <entry>Description</entry>
1352 <entry>Exit Code</entry>
171754aa
ZJS
1353 </row>
1354 </thead>
1355 <tbody>
1356 <row>
1357 <entry><literal>enabled</literal></entry>
5cd8ae31 1358 <entry morerows='1'>Enabled via <filename>.wants/</filename>, <filename>.requires/</filename> or <varname>Alias=</varname> symlinks (permanently in <filename>/etc/systemd/system/</filename>, or transiently in <filename>/run/systemd/system/</filename>).</entry>
171754aa
ZJS
1359 <entry morerows='1'>0</entry>
1360 </row>
1361 <row>
1362 <entry><literal>enabled-runtime</literal></entry>
1363 </row>
1364 <row>
1365 <entry><literal>linked</literal></entry>
48563081 1366 <entry morerows='1'>Made available through one or more symlinks to the unit file (permanently in <filename>/etc/systemd/system/</filename> or transiently in <filename>/run/systemd/system/</filename>), even though the unit file might reside outside of the unit file search path.</entry>
94f099d8 1367 <entry morerows='1'>&gt; 0</entry>
171754aa
ZJS
1368 </row>
1369 <row>
1370 <entry><literal>linked-runtime</literal></entry>
1371 </row>
1372 <row>
1373 <entry><literal>masked</literal></entry>
48563081 1374 <entry morerows='1'>Completely disabled, so that any start operation on it fails (permanently in <filename>/etc/systemd/system/</filename> or transiently in <filename>/run/systemd/systemd/</filename>).</entry>
94f099d8 1375 <entry morerows='1'>&gt; 0</entry>
171754aa
ZJS
1376 </row>
1377 <row>
1378 <entry><literal>masked-runtime</literal></entry>
1379 </row>
1380 <row>
1381 <entry><literal>static</literal></entry>
f4139308 1382 <entry>The unit file is not enabled, and has no provisions for enabling in the <literal>[Install]</literal> unit file section.</entry>
91f0ac7d 1383 <entry>0</entry>
171754aa 1384 </row>
aedd4012
JS
1385 <row>
1386 <entry><literal>indirect</literal></entry>
f6275730 1387 <entry>The unit file itself is not enabled, but it has a non-empty <varname>Also=</varname> setting in the <literal>[Install]</literal> unit file section, listing other unit files that might be enabled, or it has an alias under a different name through a symlink that is not specified in <varname>Also=</varname>. For template unit file, an instance different than the one specified in <varname>DefaultInstance=</varname> is enabled.</entry>
aedd4012
JS
1388 <entry>0</entry>
1389 </row>
171754aa
ZJS
1390 <row>
1391 <entry><literal>disabled</literal></entry>
f4139308 1392 <entry>The unit file is not enabled, but contains an <literal>[Install]</literal> section with installation instructions.</entry>
94f099d8 1393 <entry>&gt; 0</entry>
171754aa 1394 </row>
f4139308
LP
1395 <row>
1396 <entry><literal>generated</literal></entry>
1397 <entry>The unit file was generated dynamically via a generator tool. See <citerefentry><refentrytitle>systemd.generator</refentrytitle><manvolnum>7</manvolnum></citerefentry>. Generated unit files may not be enabled, they are enabled implicitly by their generator.</entry>
1398 <entry>0</entry>
1399 </row>
e4fca67f
LP
1400 <row>
1401 <entry><literal>transient</literal></entry>
1402 <entry>The unit file has been created dynamically with the runtime API. Transient units may not be enabled.</entry>
1403 <entry>0</entry>
1404 </row>
0ec0deaa
LP
1405 <row>
1406 <entry><literal>bad</literal></entry>
f4139308 1407 <entry>The unit file is invalid or another error occurred. Note that <command>is-enabled</command> will not actually return this state, but print an error message instead. However the unit file listing printed by <command>list-unit-files</command> might show it.</entry>
0ec0deaa
LP
1408 <entry>&gt; 0</entry>
1409 </row>
171754aa
ZJS
1410 </tbody>
1411 </tgroup>
1412 </table>
1413
27722f96
LN
1414 </listitem>
1415 </varlistentry>
1416
27722f96 1417 <varlistentry>
da5e955f 1418 <term><command>mask <replaceable>UNIT</replaceable>…</command></term>
27722f96
LN
1419
1420 <listitem>
3990961d
LP
1421 <para>Mask one or more units, as specified on the command line. This will link these unit files to
1422 <filename>/dev/null</filename>, making it impossible to start them. This is a stronger version of
1423 <command>disable</command>, since it prohibits all kinds of activation of the unit, including enablement
1424 and manual activation. Use this option with care. This honors the <option>--runtime</option> option to only
1425 mask temporarily until the next reboot of the system. The <option>--now</option> option may be used to
1426 ensure that the units are also stopped. This command expects valid unit names only, it does not accept unit
1427 file paths.</para>
27722f96
LN
1428 </listitem>
1429 </varlistentry>
1430
1431 <varlistentry>
da5e955f 1432 <term><command>unmask <replaceable>UNIT</replaceable>…</command></term>
27722f96
LN
1433
1434 <listitem>
3990961d
LP
1435 <para>Unmask one or more unit files, as specified on the command line. This will undo the effect of
1436 <command>mask</command>. This command expects valid unit names only, it does not accept unit file
1437 paths.</para>
27722f96
LN
1438 </listitem>
1439 </varlistentry>
1440
1441 <varlistentry>
1eecafb8 1442 <term><command>link <replaceable>PATH</replaceable>…</command></term>
27722f96
LN
1443
1444 <listitem>
3990961d
LP
1445 <para>Link a unit file that is not in the unit file search paths into the unit file search path. This
1446 command expects an absolute path to a unit file. The effect of this may be undone with
1447 <command>disable</command>. The effect of this command is that a unit file is made available for commands
2f3828e5
ZJS
1448 such as <command>start</command>, even though it is not installed directly in the unit search path. The
1449 file system where the linked unit files are located must be accessible when systemd is started
1450 (e.g. anything underneath <filename>/home</filename> or <filename>/var</filename> is not allowed, unless
1451 those directories are located on the root file system).</para>
27722f96
LN
1452 </listitem>
1453 </varlistentry>
1454
344ca755 1455 <varlistentry>
da5e955f 1456 <term><command>revert <replaceable>UNIT</replaceable>…</command></term>
344ca755
LP
1457
1458 <listitem>
1459 <para>Revert one or more unit files to their vendor versions. This command removes drop-in configuration
1460 files that modify the specified units, as well as any user-configured unit file that overrides a matching
1461 vendor supplied unit file. Specifically, for a unit <literal>foo.service</literal> the matching directories
1462 <literal>foo.service.d/</literal> with all their contained files are removed, both below the persistent and
1463 runtime configuration directories (i.e. below <filename>/etc/systemd/system</filename> and
1464 <filename>/run/systemd/system</filename>); if the unit file has a vendor-supplied version (i.e. a unit file
b17649ee 1465 located below <filename>/usr</filename>) any matching persistent or runtime unit file that overrides it is
344ca755
LP
1466 removed, too. Note that if a unit file has no vendor-supplied version (i.e. is only defined below
1467 <filename>/etc/systemd/system</filename> or <filename>/run/systemd/system</filename>, but not in a unit
1468 file stored below <filename>/usr</filename>), then it is not removed. Also, if a unit is masked, it is
1469 unmasked.</para>
1470
1471 <para>Effectively, this command may be used to undo all changes made with <command>systemctl
1472 edit</command>, <command>systemctl set-property</command> and <command>systemctl mask</command> and puts
1473 the original unit file with its settings back in effect.</para>
1474 </listitem>
1475 </varlistentry>
1476
27722f96 1477 <varlistentry>
b619ec8f 1478 <term><command>add-wants <replaceable>TARGET</replaceable>
da5e955f 1479 <replaceable>UNIT</replaceable>…</command></term>
b619ec8f 1480 <term><command>add-requires <replaceable>TARGET</replaceable>
da5e955f 1481 <replaceable>UNIT</replaceable>…</command></term>
27722f96
LN
1482
1483 <listitem>
853382da 1484 <para>Adds <literal>Wants=</literal> or <literal>Requires=</literal>
a8eaaee7 1485 dependencies, respectively, to the specified
853382da 1486 <replaceable>TARGET</replaceable> for one or more units. </para>
27722f96 1487
b619ec8f
LP
1488 <para>This command honors <option>--system</option>,
1489 <option>--user</option>, <option>--runtime</option> and
a8eaaee7 1490 <option>--global</option> in a way similar to
b619ec8f 1491 <command>enable</command>.</para>
27722f96 1492
27722f96
LN
1493 </listitem>
1494 </varlistentry>
7d4fb3b1
RC
1495
1496 <varlistentry>
da5e955f 1497 <term><command>edit <replaceable>UNIT</replaceable>…</command></term>
7d4fb3b1
RC
1498
1499 <listitem>
1500 <para>Edit a drop-in snippet or a whole replacement file if
1501 <option>--full</option> is specified, to extend or override the
1502 specified unit.</para>
1503
1504 <para>Depending on whether <option>--system</option> (the default),
1505 <option>--user</option>, or <option>--global</option> is specified,
a8eaaee7 1506 this command creates a drop-in file for each unit either for the system,
b938cb90 1507 for the calling user, or for all futures logins of all users. Then,
7d4fb3b1
RC
1508 the editor (see the "Environment" section below) is invoked on
1509 temporary files which will be written to the real location if the
1510 editor exits successfully.</para>
1511
1512 <para>If <option>--full</option> is specified, this will copy the
1513 original units instead of creating drop-in files.</para>
1514
39c38ce1
DC
1515 <para>If <option>--force</option> is specified and any units do
1516 not already exist, new unit files will be opened for editing.</para>
1517
7d4fb3b1
RC
1518 <para>If <option>--runtime</option> is specified, the changes will
1519 be made temporarily in <filename>/run</filename> and they will be
1520 lost on the next reboot.</para>
1521
b938cb90
JE
1522 <para>If the temporary file is empty upon exit, the modification of
1523 the related unit is canceled.</para>
7d4fb3b1
RC
1524
1525 <para>After the units have been edited, systemd configuration is
1526 reloaded (in a way that is equivalent to <command>daemon-reload</command>).
1527 </para>
1528
1529 <para>Note that this command cannot be used to remotely edit units
1530 and that you cannot temporarily edit units which are in
b938cb90 1531 <filename>/etc</filename>, since they take precedence over
7d4fb3b1
RC
1532 <filename>/run</filename>.</para>
1533 </listitem>
1534 </varlistentry>
b619ec8f
LP
1535
1536 <varlistentry>
1537 <term><command>get-default</command></term>
1538
1539 <listitem>
1540 <para>Return the default target to boot into. This returns
1541 the target unit name <filename>default.target</filename>
1542 is aliased (symlinked) to.</para>
1543 </listitem>
1544 </varlistentry>
1545
1546 <varlistentry>
da5e955f 1547 <term><command>set-default <replaceable>TARGET</replaceable></command></term>
b619ec8f
LP
1548
1549 <listitem>
1550 <para>Set the default target to boot into. This sets
1551 (symlinks) the <filename>default.target</filename> alias
1552 to the given target unit.</para>
1553 </listitem>
1554 </varlistentry>
1555
27722f96
LN
1556 </variablelist>
1557 </refsect2>
1558
0d292f5e
LP
1559 <refsect2>
1560 <title>Machine Commands</title>
1561
1562 <variablelist>
1563 <varlistentry>
e92b3655 1564 <term><command>list-machines</command> <optional><replaceable>PATTERN</replaceable>…</optional></term>
0d292f5e
LP
1565
1566 <listitem>
1567 <para>List the host and all running local containers with
1568 their state. If one or more
1569 <replaceable>PATTERN</replaceable>s are specified, only
1570 containers matching one of them are shown.
1571 </para>
1572 </listitem>
1573 </varlistentry>
1574 </variablelist>
1575 </refsect2>
1576
27722f96
LN
1577 <refsect2>
1578 <title>Job Commands</title>
1579
1580 <variablelist>
1581 <varlistentry>
1eecafb8 1582 <term><command>list-jobs <optional><replaceable>PATTERN…</replaceable></optional></command></term>
27722f96
LN
1583
1584 <listitem>
d8fba7c6
ZJS
1585 <para>List jobs that are in progress. If one or more
1586 <replaceable>PATTERN</replaceable>s are specified, only
1587 jobs for units matching one of them are shown.</para>
82948f6c
LP
1588
1589 <para>When combined with <option>--after</option> or <option>--before</option> the list is augmented with
1590 information on which other job each job is waiting for, and which other jobs are waiting for it, see
1591 above.</para>
27722f96
LN
1592 </listitem>
1593 </varlistentry>
1594 <varlistentry>
1eecafb8 1595 <term><command>cancel <replaceable>JOB</replaceable>…</command></term>
27722f96
LN
1596
1597 <listitem>
1598 <para>Cancel one or more jobs specified on the command line
1599 by their numeric job IDs. If no job ID is specified, cancel
1600 all pending jobs.</para>
1601 </listitem>
1602 </varlistentry>
1603 </variablelist>
27722f96
LN
1604 </refsect2>
1605
1606 <refsect2>
1607 <title>Environment Commands</title>
1608
1609 <variablelist>
1610 <varlistentry>
1611 <term><command>show-environment</command></term>
1612
1613 <listitem>
804ee07c
ZJS
1614 <para>Dump the systemd manager environment block. This is the environment
1615 block that is passed to all processes the manager spawns. The environment
1616 block will be dumped in straight-forward form suitable for sourcing into
1617 most shells. If no special characters or whitespace is present in the variable
1618 values, no escaping is performed, and the assignments have the form
1619 <literal>VARIABLE=value</literal>. If whitespace or characters which have
1620 special meaning to the shell are present, dollar-single-quote escaping is
1621 used, and assignments have the form <literal>VARIABLE=$'value'</literal>.
1622 This syntax is known to be supported by
1623 <citerefentry project='die-net'><refentrytitle>bash</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1624 <citerefentry project='die-net'><refentrytitle>zsh</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1625 <citerefentry project='die-net'><refentrytitle>ksh</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1626 and
1627 <citerefentry project='die-net'><refentrytitle>busybox</refentrytitle><manvolnum>1</manvolnum></citerefentry>'s
1628 <citerefentry project='die-net'><refentrytitle>ash</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1629 but not
1630 <citerefentry project='die-net'><refentrytitle>dash</refentrytitle><manvolnum>1</manvolnum></citerefentry>
1631 or
1632 <citerefentry project='die-net'><refentrytitle>fish</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
1633 </para>
27722f96
LN
1634 </listitem>
1635 </varlistentry>
1636 <varlistentry>
1eecafb8 1637 <term><command>set-environment <replaceable>VARIABLE=VALUE</replaceable>…</command></term>
27722f96
LN
1638
1639 <listitem>
1640 <para>Set one or more systemd manager environment variables,
1641 as specified on the command line.</para>
1642 </listitem>
1643 </varlistentry>
1644 <varlistentry>
1eecafb8 1645 <term><command>unset-environment <replaceable>VARIABLE</replaceable>…</command></term>
27722f96
LN
1646
1647 <listitem>
1648 <para>Unset one or more systemd manager environment
1649 variables. If only a variable name is specified, it will be
1650 removed regardless of its value. If a variable and a value
1651 are specified, the variable is only removed if it has the
1652 specified value.</para>
1653 </listitem>
ac3efa8a
LP
1654 </varlistentry>
1655 <varlistentry>
3fb90db2 1656 <term>
b975b0d5 1657 <command>import-environment</command>
1eecafb8 1658 <optional><replaceable>VARIABLE…</replaceable></optional>
b975b0d5 1659 </term>
ac3efa8a
LP
1660
1661 <listitem>
1662 <para>Import all, one or more environment variables set on
1663 the client into the systemd manager environment block. If
73e231ab
JE
1664 no arguments are passed, the entire environment block is
1665 imported. Otherwise, a list of one or more environment
1666 variable names should be passed, whose client-side values
ac3efa8a
LP
1667 are then imported into the manager's environment
1668 block.</para>
1669 </listitem>
27722f96
LN
1670 </varlistentry>
1671 </variablelist>
1672 </refsect2>
1673
1674 <refsect2>
1675 <title>Manager Lifecycle Commands</title>
1676
1677 <variablelist>
1678 <varlistentry>
1679 <term><command>daemon-reload</command></term>
1680
1681 <listitem>
a8eaaee7 1682 <para>Reload the systemd manager configuration. This will
432d5965
ZJS
1683 rerun all generators (see
1684 <citerefentry><refentrytitle>systemd.generator</refentrytitle><manvolnum>7</manvolnum></citerefentry>),
1685 reload all unit files, and recreate the entire dependency
1686 tree. While the daemon is being reloaded, all sockets
1687 systemd listens on behalf of user configuration will stay
1688 accessible.</para>
1689
1690 <para>This command should not be confused with the
1691 <command>reload</command> command.</para>
27722f96
LN
1692 </listitem>
1693 </varlistentry>
1694 <varlistentry>
1695 <term><command>daemon-reexec</command></term>
1696
1697 <listitem>
1698 <para>Reexecute the systemd manager. This will serialize the
1699 manager state, reexecute the process and deserialize the
1700 state again. This command is of little use except for
79640424 1701 debugging and package upgrades. Sometimes, it might be
27722f96 1702 helpful as a heavy-weight <command>daemon-reload</command>.
79640424 1703 While the daemon is being reexecuted, all sockets systemd listening
27722f96
LN
1704 on behalf of user configuration will stay accessible.
1705 </para>
1706 </listitem>
1707 </varlistentry>
1708 </variablelist>
1709 </refsect2>
1710
1711 <refsect2>
1712 <title>System Commands</title>
1713
1714 <variablelist>
99813a19
LP
1715 <varlistentry>
1716 <term><command>is-system-running</command></term>
1717
1718 <listitem>
2de51fdc 1719 <para>Checks whether the system is operational. This
94f099d8
LP
1720 returns success (exit code 0) when the system is fully up
1721 and running, specifically not in startup, shutdown or
1722 maintenance mode, and with no failed services. Failure is
1723 returned otherwise (exit code non-zero). In addition, the
2de51fdc 1724 current state is printed in a short string to standard
a8eaaee7 1725 output, see the table below. Use <option>--quiet</option> to
2de51fdc
ZJS
1726 suppress this output.</para>
1727
adb6cd9b
FB
1728 <para>Use <option>--wait</option> to wait until the boot
1729 process is completed before printing the current state and
1730 returning the appropriate error status. If <option>--wait</option>
1731 is in use, states <varname>initializing</varname> or
1732 <varname>starting</varname> will not be reported, instead
1733 the command will block until a later state (such as
1734 <varname>running</varname> or <varname>degraded</varname>)
1735 is reached.</para>
1736
2de51fdc 1737 <table>
94f099d8
LP
1738 <title><command>is-system-running</command> output</title>
1739 <tgroup cols='3'>
1740 <colspec colname='name'/>
1741 <colspec colname='description'/>
1742 <colspec colname='exit-code'/>
2de51fdc
ZJS
1743 <thead>
1744 <row>
1745 <entry>Name</entry>
1746 <entry>Description</entry>
94f099d8 1747 <entry>Exit Code</entry>
2de51fdc
ZJS
1748 </row>
1749 </thead>
1750 <tbody>
1751 <row>
1752 <entry><varname>initializing</varname></entry>
1753 <entry><para>Early bootup, before
1fdfa094
LP
1754 <filename>basic.target</filename> is reached
1755 or the <varname>maintenance</varname> state entered.
2de51fdc 1756 </para></entry>
94f099d8 1757 <entry>&gt; 0</entry>
2de51fdc
ZJS
1758 </row>
1759 <row>
1760 <entry><varname>starting</varname></entry>
1fdfa094
LP
1761 <entry><para>Late bootup, before the job queue
1762 becomes idle for the first time, or one of the
1763 rescue targets are reached.</para></entry>
94f099d8 1764 <entry>&gt; 0</entry>
2de51fdc
ZJS
1765 </row>
1766 <row>
1767 <entry><varname>running</varname></entry>
1768 <entry><para>The system is fully
1769 operational.</para></entry>
94f099d8 1770 <entry>0</entry>
2de51fdc
ZJS
1771 </row>
1772 <row>
1773 <entry><varname>degraded</varname></entry>
1774 <entry><para>The system is operational but one or more
1775 units failed.</para></entry>
94f099d8 1776 <entry>&gt; 0</entry>
2de51fdc
ZJS
1777 </row>
1778 <row>
1779 <entry><varname>maintenance</varname></entry>
1fdfa094 1780 <entry><para>The rescue or emergency target is
2de51fdc 1781 active.</para></entry>
94f099d8 1782 <entry>&gt; 0</entry>
2de51fdc
ZJS
1783 </row>
1784 <row>
1785 <entry><varname>stopping</varname></entry>
1786 <entry><para>The manager is shutting
1787 down.</para></entry>
94f099d8
LP
1788 <entry>&gt; 0</entry>
1789 </row>
1790 <row>
1791 <entry><varname>offline</varname></entry>
1792 <entry><para>The manager is not
1793 running. Specifically, this is the operational
1794 state if an incompatible program is running as
1795 system manager (PID 1).</para></entry>
1796 <entry>&gt; 0</entry>
1797 </row>
1798 <row>
1799 <entry><varname>unknown</varname></entry>
1800 <entry><para>The operational state could not be
1801 determined, due to lack of resources or another
1802 error cause.</para></entry>
1803 <entry>&gt; 0</entry>
2de51fdc
ZJS
1804 </row>
1805 </tbody>
1806 </tgroup>
1807 </table>
99813a19
LP
1808 </listitem>
1809 </varlistentry>
1810
27722f96
LN
1811 <varlistentry>
1812 <term><command>default</command></term>
1813
1814 <listitem>
6324a8a7
LP
1815 <para>Enter default mode. This is equivalent to <command>systemctl isolate default.target</command>. This
1816 operation is blocking by default, use <option>--no-block</option> to request asynchronous behavior.</para>
27722f96
LN
1817 </listitem>
1818 </varlistentry>
99813a19 1819
27722f96
LN
1820 <varlistentry>
1821 <term><command>rescue</command></term>
1822
1823 <listitem>
6324a8a7
LP
1824 <para>Enter rescue mode. This is equivalent to <command>systemctl isolate rescue.target</command>. This
1825 operation is blocking by default, use <option>--no-block</option> to request asynchronous behavior.</para>
27722f96
LN
1826 </listitem>
1827 </varlistentry>
1828 <varlistentry>
1829 <term><command>emergency</command></term>
1830
1831 <listitem>
6324a8a7
LP
1832 <para>Enter emergency mode. This is equivalent to <command>systemctl isolate
1833 emergency.target</command>. This operation is blocking by default, use <option>--no-block</option> to
1834 request asynchronous behavior.</para>
27722f96
LN
1835 </listitem>
1836 </varlistentry>
1837 <varlistentry>
1838 <term><command>halt</command></term>
1839
1840 <listitem>
6324a8a7
LP
1841 <para>Shut down and halt the system. This is mostly equivalent to <command>systemctl start halt.target
1842 --job-mode=replace-irreversibly --no-block</command>, but also prints a wall message to all users. This command is
1843 asynchronous; it will return after the halt operation is enqueued, without waiting for it to complete. Note
1844 that this operation will simply halt the OS kernel after shutting down, leaving the hardware powered
1845 on. Use <command>systemctl poweroff</command> for powering off the system (see below).</para>
1846
1847 <para>If combined with <option>--force</option>, shutdown of all running services is skipped, however all
1848 processes are killed and all file systems are unmounted or mounted read-only, immediately followed by the
1849 system halt. If <option>--force</option> is specified twice, the operation is immediately executed without
1850 terminating any processes or unmounting any file systems. This may result in data loss. Note that when
1851 <option>--force</option> is specified twice the halt operation is executed by <command>systemctl</command>
1852 itself, and the system manager is not contacted. This means the command should succeed even when the system
1853 manager has crashed.</para>
27722f96
LN
1854 </listitem>
1855 </varlistentry>
1856 <varlistentry>
1857 <term><command>poweroff</command></term>
1858
1859 <listitem>
6324a8a7
LP
1860 <para>Shut down and power-off the system. This is mostly equivalent to <command>systemctl start
1861 poweroff.target --job-mode=replace-irreversibly --no-block</command>, but also prints a wall message to all
1862 users. This command is asynchronous; it will return after the power-off operation is enqueued, without
1863 waiting for it to complete.</para>
1864
1865 <para>If combined with <option>--force</option>, shutdown of all running services is skipped, however all
1866 processes are killed and all file systems are unmounted or mounted read-only, immediately followed by the
1867 powering off. If <option>--force</option> is specified twice, the operation is immediately executed without
1868 terminating any processes or unmounting any file systems. This may result in data loss. Note that when
924e44b4
LP
1869 <option>--force</option> is specified twice the power-off operation is executed by
1870 <command>systemctl</command> itself, and the system manager is not contacted. This means the command should
6324a8a7 1871 succeed even when the system manager has crashed.</para>
27722f96
LN
1872 </listitem>
1873 </varlistentry>
1874 <varlistentry>
e92b3655 1875 <term><command>reboot</command> <optional><replaceable>arg</replaceable></optional></term>
27722f96
LN
1876
1877 <listitem>
6324a8a7
LP
1878 <para>Shut down and reboot the system. This is mostly equivalent to <command>systemctl start reboot.target
1879 --job-mode=replace-irreversibly --no-block</command>, but also prints a wall message to all users. This
1880 command is asynchronous; it will return after the reboot operation is enqueued, without waiting for it to
1881 complete.</para>
1882
1883 <para>If combined with <option>--force</option>, shutdown of all running services is skipped, however all
1884 processes are killed and all file systems are unmounted or mounted read-only, immediately followed by the
1885 reboot. If <option>--force</option> is specified twice, the operation is immediately executed without
1886 terminating any processes or unmounting any file systems. This may result in data loss. Note that when
924e44b4
LP
1887 <option>--force</option> is specified twice the reboot operation is executed by
1888 <command>systemctl</command> itself, and the system manager is not contacted. This means the command should
6324a8a7
LP
1889 succeed even when the system manager has crashed.</para>
1890
1891 <para>If the optional argument <replaceable>arg</replaceable> is given, it will be passed as the optional
1892 argument to the <citerefentry><refentrytitle>reboot</refentrytitle><manvolnum>2</manvolnum></citerefentry>
1893 system call. The value is architecture and firmware specific. As an example, <literal>recovery</literal>
1894 might be used to trigger system recovery, and <literal>fota</literal> might be used to trigger a
37185ec8 1895 <quote>firmware over the air</quote> update.</para>
27722f96
LN
1896 </listitem>
1897 </varlistentry>
b619ec8f 1898
27722f96
LN
1899 <varlistentry>
1900 <term><command>kexec</command></term>
1901
1902 <listitem>
6324a8a7
LP
1903 <para>Shut down and reboot the system via <command>kexec</command>. This is equivalent to
1904 <command>systemctl start kexec.target --job-mode=replace-irreversibly --no-block</command>. This command is
1905 asynchronous; it will return after the reboot operation is enqueued, without waiting for it to
1906 complete.</para>
1907
1908 <para>If combined with <option>--force</option>, shutdown of all running services is skipped, however all
1909 processes are killed and all file systems are unmounted or mounted read-only, immediately followed by the
1910 reboot.</para>
27722f96
LN
1911 </listitem>
1912 </varlistentry>
b619ec8f 1913
27722f96 1914 <varlistentry>
e92b3655 1915 <term><command>exit</command> <optional><replaceable>EXIT_CODE</replaceable></optional></term>
27722f96
LN
1916
1917 <listitem>
6324a8a7
LP
1918 <para>Ask the service manager to quit. This is only supported for user service managers (i.e. in
1919 conjunction with the <option>--user</option> option) or in containers and is equivalent to
1920 <command>poweroff</command> otherwise. This command is asynchronous; it will return after the exit
1921 operation is enqueued, without waiting for it to complete.</para>
1922
dcfaecc7 1923 <para>The service manager will exit with the specified exit code, if
6324a8a7 1924 <replaceable>EXIT_CODE</replaceable> is passed.</para>
27722f96 1925 </listitem>
b619ec8f 1926 </varlistentry>
27722f96 1927
b619ec8f 1928 <varlistentry>
e92b3655 1929 <term><command>switch-root</command> <replaceable>ROOT</replaceable> <optional><replaceable>INIT</replaceable></optional></term>
b619ec8f
LP
1930
1931 <listitem>
fb1bad9d
LP
1932 <para>Switches to a different root directory and executes a new system manager process below it. This is
1933 intended for usage in initial RAM disks ("initrd"), and will transition from the initrd's system manager
1934 process (a.k.a. "init" process) to the main system manager process which is loaded from the actual host
1935 volume. This call takes two arguments: the directory that is to become the new root directory, and the path
1936 to the new system manager binary below it to execute as PID 1. If the latter is omitted or the empty
1937 string, a systemd binary will automatically be searched for and used as init. If the system manager path is
1938 omitted, equal to the empty string or identical to the path to the systemd binary, the state of the
1939 initrd's system manager process is passed to the main system manager, which allows later introspection of
1940 the state of the services involved in the initrd boot phase.</para>
b619ec8f 1941 </listitem>
27722f96 1942 </varlistentry>
b619ec8f 1943
27722f96
LN
1944 <varlistentry>
1945 <term><command>suspend</command></term>
1946
1947 <listitem>
6324a8a7
LP
1948 <para>Suspend the system. This will trigger activation of the special target unit
1949 <filename>suspend.target</filename>. This command is asynchronous, and will return after the suspend
1950 operation is successfully enqueued. It will not wait for the suspend/resume cycle to complete.</para>
27722f96
LN
1951 </listitem>
1952 </varlistentry>
b619ec8f 1953
27722f96
LN
1954 <varlistentry>
1955 <term><command>hibernate</command></term>
1956
1957 <listitem>
6324a8a7
LP
1958 <para>Hibernate the system. This will trigger activation of the special target unit
1959 <filename>hibernate.target</filename>. This command is asynchronous, and will return after the hibernation
1960 operation is successfully enqueued. It will not wait for the hibernate/thaw cycle to complete.</para>
27722f96
LN
1961 </listitem>
1962 </varlistentry>
b619ec8f 1963
27722f96
LN
1964 <varlistentry>
1965 <term><command>hybrid-sleep</command></term>
1966
1967 <listitem>
6324a8a7
LP
1968 <para>Hibernate and suspend the system. This will trigger activation of the special target unit
1969 <filename>hybrid-sleep.target</filename>. This command is asynchronous, and will return after the hybrid
1970 sleep operation is successfully enqueued. It will not wait for the sleep/wake-up cycle to complete.</para>
27722f96
LN
1971 </listitem>
1972 </varlistentry>
6cc2b882
JD
1973
1974 <varlistentry>
1975 <term><command>suspend-then-hibernate</command></term>
1976
1977 <listitem>
1978 <para>Suspend the system and hibernate it after the delay specified in <filename>systemd-sleep.conf</filename>.
1979 This will trigger activation of the special target unit <filename>suspend-then-hibernate.target</filename>.
1980 This command is asynchronous, and will return after the hybrid sleep operation is successfully enqueued.
1981 It will not wait for the sleep/wake-up or hibernate/thaw cycle to complete.</para>
1982 </listitem>
1983 </varlistentry>
27722f96
LN
1984 </variablelist>
1985 </refsect2>
4a6022f0 1986
a7c0e5d7
LP
1987 <refsect2>
1988 <title>Parameter Syntax</title>
1989
da5e955f 1990 <para>Unit commands listed above take either a single unit name (designated as <replaceable>UNIT</replaceable>),
1eecafb8 1991 or multiple unit specifications (designated as <replaceable>PATTERN</replaceable>…). In the first case, the
da25e029
ZJS
1992 unit name with or without a suffix must be given. If the suffix is not specified (unit name is "abbreviated"),
1993 systemctl will append a suitable suffix, <literal>.service</literal> by default, and a type-specific suffix in
1994 case of commands which operate only on specific unit types. For example,
e3e0314b
ZJS
1995 <programlisting># systemctl start sshd</programlisting> and
1996 <programlisting># systemctl start sshd.service</programlisting>
1997 are equivalent, as are
507e28d8 1998 <programlisting># systemctl isolate default</programlisting>
e3e0314b 1999 and
507e28d8 2000 <programlisting># systemctl isolate default.target</programlisting>
da25e029
ZJS
2001 Note that (absolute) paths to device nodes are automatically converted to device unit names, and other (absolute)
2002 paths to mount unit names.
e3e0314b
ZJS
2003 <programlisting># systemctl status /dev/sda
2004# systemctl status /home</programlisting>
2005 are equivalent to:
2006 <programlisting># systemctl status dev-sda.device
2007# systemctl status home.mount</programlisting>
2cdbbc9a 2008 In the second case, shell-style globs will be matched against the primary names of all units currently in memory;
1f00eded
LP
2009 literal unit names, with or without a suffix, will be treated as in the first case. This means that literal unit
2010 names always refer to exactly one unit, but globs may match zero units and this is not considered an
2011 error.</para>
e3e0314b
ZJS
2012
2013 <para>Glob patterns use
decde8cd 2014 <citerefentry project='man-pages'><refentrytitle>fnmatch</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
e3e0314b
ZJS
2015 so normal shell-style globbing rules are used, and
2016 <literal>*</literal>, <literal>?</literal>,
2017 <literal>[]</literal> may be used. See
decde8cd 2018 <citerefentry project='man-pages'><refentrytitle>glob</refentrytitle><manvolnum>7</manvolnum></citerefentry>
1f00eded 2019 for more details. The patterns are matched against the primary names of
2cdbbc9a 2020 units currently in memory, and patterns which do not match anything
e3e0314b
ZJS
2021 are silently skipped. For example:
2022 <programlisting># systemctl stop sshd@*.service</programlisting>
1f00eded 2023 will stop all <filename>sshd@.service</filename> instances. Note that alias names of units, and units that aren't
2cdbbc9a 2024 in memory are not considered for glob expansion.
e3e0314b
ZJS
2025 </para>
2026
da5e955f 2027 <para>For unit file commands, the specified <replaceable>UNIT</replaceable> should be the name of the unit file
1534e170 2028 (possibly abbreviated, see above), or the absolute path to the unit file:
e3e0314b
ZJS
2029 <programlisting># systemctl enable foo.service</programlisting>
2030 or
2031 <programlisting># systemctl link /path/to/foo.service</programlisting>
2032 </para>
a7c0e5d7
LP
2033 </refsect2>
2034
4a6022f0
ZJS
2035 </refsect1>
2036
2037 <refsect1>
2038 <title>Exit status</title>
2039
23a9ffb0
ZJS
2040 <para>On success, 0 is returned, a non-zero failure code otherwise.</para>
2041
2042 <para><command>systemctl</command> uses the return codes defined by LSB, as defined in
2043 <ulink url="http://refspecs.linuxbase.org/LSB_3.0.0/LSB-PDA/LSB-PDA/iniscrptact.html">LSB 3.0.0</ulink>.
2044 </para>
2045
2046 <table>
2047 <title>LSB return codes</title>
2048
2049 <tgroup cols='3'>
2050 <thead>
2051 <row>
2052 <entry>Value</entry>
2053 <entry>Description in LSB</entry>
2054 <entry>Use in systemd</entry>
2055 </row>
2056 </thead>
2057 <tbody>
2058 <row>
2059 <entry><constant>0</constant></entry>
2060 <entry>"program is running or service is OK"</entry>
2061 <entry>unit is active</entry>
2062 </row>
2063 <row>
2064 <entry><constant>1</constant></entry>
2065 <entry>"program is dead and <filename>/var/run</filename> pid file exists"</entry>
2066 <entry>unit <emphasis>not</emphasis> failed (used by <command>is-failed</command>)</entry>
2067 </row>
2068 <row>
2069 <entry><constant>2</constant></entry>
2070 <entry>"program is dead and <filename>/var/lock</filename> lock file exists"</entry>
2071 <entry>unused</entry>
2072 </row>
2073 <row>
2074 <entry><constant>3</constant></entry>
2075 <entry>"program is not running"</entry>
2076 <entry>unit is not active</entry>
2077 </row>
2078 <row>
2079 <entry><constant>4</constant></entry>
2080 <entry>"program or service status is unknown"</entry>
2081 <entry>no such unit</entry>
2082 </row>
2083 </tbody>
2084 </tgroup>
2085 </table>
2086
2087 <para>The mapping of LSB service states to systemd unit states is imperfect, so it is better to
2088 not rely on those return values but to look for specific unit states and substates instead.
2089 </para>
4a6022f0
ZJS
2090 </refsect1>
2091
7d4fb3b1
RC
2092 <refsect1>
2093 <title>Environment</title>
2094
2095 <variablelist class='environment-variables'>
2096 <varlistentry>
2097 <term><varname>$SYSTEMD_EDITOR</varname></term>
2098
2099 <listitem><para>Editor to use when editing units; overrides
2100 <varname>$EDITOR</varname> and <varname>$VISUAL</varname>. If neither
2101 <varname>$SYSTEMD_EDITOR</varname> nor <varname>$EDITOR</varname> nor
2102 <varname>$VISUAL</varname> are present or if it is set to an empty
2103 string or if their execution failed, systemctl will try to execute well
2104 known editors in this order:
9391a1c3 2105 <citerefentry project='die-net'><refentrytitle>editor</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
3ba3a79d
ZJS
2106 <citerefentry project='die-net'><refentrytitle>nano</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
2107 <citerefentry project='die-net'><refentrytitle>vim</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
2108 <citerefentry project='die-net'><refentrytitle>vi</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
7d4fb3b1
RC
2109 </para></listitem>
2110 </varlistentry>
2111 </variablelist>
2112 <xi:include href="less-variables.xml" xpointer="pager"/>
2113 <xi:include href="less-variables.xml" xpointer="less"/>
6e16066e 2114 <xi:include href="less-variables.xml" xpointer="lesscharset"/>
7d4fb3b1 2115 </refsect1>
4a6022f0
ZJS
2116
2117 <refsect1>
2118 <title>See Also</title>
2119 <para>
2120 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
4a6022f0
ZJS
2121 <citerefentry><refentrytitle>journalctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
2122 <citerefentry><refentrytitle>loginctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
a03fe1a5 2123 <citerefentry><refentrytitle>machinectl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
4a6022f0 2124 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
ee41f602 2125 <citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
4a6022f0 2126 <citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
5aded369 2127 <citerefentry project='man-pages'><refentrytitle>wall</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
7d4fb3b1 2128 <citerefentry><refentrytitle>systemd.preset</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
432d5965 2129 <citerefentry><refentrytitle>systemd.generator</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
decde8cd 2130 <citerefentry project='man-pages'><refentrytitle>glob</refentrytitle><manvolnum>7</manvolnum></citerefentry>
4a6022f0
ZJS
2131 </para>
2132 </refsect1>
7874bcd6
LP
2133
2134</refentry>