]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/systemctl.xml
core,systemctl: add new "systemctl revert" command
[thirdparty/systemd.git] / man / systemctl.xml
1 <?xml version='1.0'?> <!--*- Mode: nxml; nxml-child-indent: 2; indent-tabs-mode: nil -*-->
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
4 <!ENTITY % entities SYSTEM "custom-entities.ent" >
5 %entities;
6 ]>
7
8 <!--
9 This file is part of systemd.
10
11 Copyright 2010 Lennart Poettering
12
13 systemd is free software; you can redistribute it and/or modify it
14 under the terms of the GNU Lesser General Public License as published by
15 the Free Software Foundation; either version 2.1 of the License, or
16 (at your option) any later version.
17
18 systemd is distributed in the hope that it will be useful, but
19 WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 Lesser General Public License for more details.
22
23 You should have received a copy of the GNU Lesser General Public License
24 along with systemd; If not, see <http://www.gnu.org/licenses/>.
25 -->
26
27 <refentry id="systemctl"
28 xmlns:xi="http://www.w3.org/2001/XInclude">
29
30 <refentryinfo>
31 <title>systemctl</title>
32 <productname>systemd</productname>
33
34 <authorgroup>
35 <author>
36 <contrib>Developer</contrib>
37 <firstname>Lennart</firstname>
38 <surname>Poettering</surname>
39 <email>lennart@poettering.net</email>
40 </author>
41 </authorgroup>
42 </refentryinfo>
43
44 <refmeta>
45 <refentrytitle>systemctl</refentrytitle>
46 <manvolnum>1</manvolnum>
47 </refmeta>
48
49 <refnamediv>
50 <refname>systemctl</refname>
51 <refpurpose>Control the systemd system and service manager</refpurpose>
52 </refnamediv>
53
54 <refsynopsisdiv>
55 <cmdsynopsis>
56 <command>systemctl</command>
57 <arg choice="opt" rep="repeat">OPTIONS</arg>
58 <arg choice="plain">COMMAND</arg>
59 <arg choice="opt" rep="repeat">NAME</arg>
60 </cmdsynopsis>
61 </refsynopsisdiv>
62
63 <refsect1>
64 <title>Description</title>
65
66 <para><command>systemctl</command> may be used to introspect and
67 control the state of the <literal>systemd</literal> system and
68 service manager. Please refer to
69 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>
70 for an introduction into the basic concepts and functionality this
71 tool manages.</para>
72 </refsect1>
73
74 <refsect1>
75 <title>Options</title>
76
77 <para>The following options are understood:</para>
78
79 <variablelist>
80 <varlistentry>
81 <term><option>-t</option></term>
82 <term><option>--type=</option></term>
83
84 <listitem>
85 <para>The argument should be a comma-separated list of unit
86 types such as <option>service</option> and
87 <option>socket</option>.
88 </para>
89
90 <para>If one of the arguments is a unit type, when listing
91 units, limit display to certain unit types. Otherwise, units
92 of all types will be shown.</para>
93
94 <para>As a special case, if one of the arguments is
95 <option>help</option>, a list of allowed values will be
96 printed and the program will exit.</para>
97 </listitem>
98 </varlistentry>
99
100 <varlistentry>
101 <term><option>--state=</option></term>
102
103 <listitem>
104 <para>The argument should be a comma-separated list of unit
105 LOAD, SUB, or ACTIVE states. When listing units, show only
106 those in the specified states. Use <option>--state=failed</option>
107 to show only failed units.</para>
108
109 <para>As a special case, if one of the arguments is
110 <option>help</option>, a list of allowed values will be
111 printed and the program will exit.</para>
112 </listitem>
113 </varlistentry>
114
115 <varlistentry>
116 <term><option>-p</option></term>
117 <term><option>--property=</option></term>
118
119 <listitem>
120 <para>When showing unit/job/manager properties with the
121 <command>show</command> command, limit display to properties
122 specified in the argument. The argument should be a
123 comma-separated list of property names, such as
124 <literal>MainPID</literal>. Unless specified, all known
125 properties are shown. If specified more than once, all
126 properties with the specified names are shown. Shell
127 completion is implemented for property names.</para>
128
129 <para>For the manager itself,
130 <command>systemctl show</command> will show all available
131 properties. Those properties are documented in
132 <citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
133 </para>
134
135 <para>Properties for units vary by unit type, so showing any
136 unit (even a non-existent one) is a way to list properties
137 pertaining to this type. Similarly, showing any job will list
138 properties pertaining to all jobs. Properties for units are
139 documented in
140 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
141 and the pages for individual unit types
142 <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
143 <citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
144 etc.</para>
145 </listitem>
146 </varlistentry>
147
148 <varlistentry>
149 <term><option>-a</option></term>
150 <term><option>--all</option></term>
151
152 <listitem>
153 <para>When listing units, show all loaded units, regardless
154 of their state, including inactive units. When showing
155 unit/job/manager properties, show all properties regardless
156 whether they are set or not.</para>
157 <para>To list all units installed on the system, use the
158 <command>list-unit-files</command> command instead.</para>
159 </listitem>
160 </varlistentry>
161
162 <varlistentry>
163 <term><option>-r</option></term>
164 <term><option>--recursive</option></term>
165
166 <listitem>
167 <para>When listing units, also show units of local
168 containers. Units of local containers will be prefixed with
169 the container name, separated by a single colon character
170 (<literal>:</literal>).</para>
171 </listitem>
172 </varlistentry>
173
174 <varlistentry>
175 <term><option>--reverse</option></term>
176
177 <listitem>
178 <para>Show reverse dependencies between units with
179 <command>list-dependencies</command>, i.e. follow
180 dependencies of type <varname>WantedBy=</varname>,
181 <varname>RequiredBy=</varname>,
182 <varname>PartOf=</varname>, <varname>BoundBy=</varname>,
183 instead of <varname>Wants=</varname> and similar.
184 </para>
185 </listitem>
186 </varlistentry>
187
188 <varlistentry>
189 <term><option>--after</option></term>
190
191 <listitem>
192 <para>With <command>list-dependencies</command>, show the
193 units that are ordered before the specified unit. In other
194 words, recursively list units following the
195 <varname>After=</varname> dependency.</para>
196
197 <para>Note that any <varname>After=</varname> dependency is
198 automatically mirrored to create a
199 <varname>Before=</varname> dependency. Temporal dependencies
200 may be specified explicitly, but are also created implicitly
201 for units which are <varname>WantedBy=</varname> targets
202 (see
203 <citerefentry><refentrytitle>systemd.target</refentrytitle><manvolnum>5</manvolnum></citerefentry>),
204 and as a result of other directives (for example
205 <varname>RequiresMountsFor=</varname>). Both explicitly
206 and implicitly introduced dependencies are shown with
207 <command>list-dependencies</command>.</para>
208 </listitem>
209 </varlistentry>
210
211 <varlistentry>
212 <term><option>--before</option></term>
213
214 <listitem>
215 <para>With <command>list-dependencies</command>, show the
216 units that are ordered after the specified unit. In other
217 words, recursively list units following the
218 <varname>Before=</varname> dependency.</para>
219 </listitem>
220 </varlistentry>
221
222 <varlistentry>
223 <term><option>-l</option></term>
224 <term><option>--full</option></term>
225
226 <listitem>
227 <para>Do not ellipsize unit names, process tree entries,
228 journal output, or truncate unit descriptions in the output
229 of <command>status</command>, <command>list-units</command>,
230 <command>list-jobs</command>, and
231 <command>list-timers</command>.</para>
232 </listitem>
233 </varlistentry>
234
235 <varlistentry>
236 <term><option>--value</option></term>
237
238 <listitem>
239 <para>When printing properties with <command>show</command>,
240 only print the value, and skip the property name and
241 <literal>=</literal>.</para>
242 </listitem>
243 </varlistentry>
244
245 <varlistentry>
246 <term><option>--show-types</option></term>
247
248 <listitem>
249 <para>When showing sockets, show the type of the socket.</para>
250 </listitem>
251 </varlistentry>
252
253 <varlistentry>
254 <term><option>--job-mode=</option></term>
255
256 <listitem>
257 <para>When queuing a new job, this option controls how to deal with
258 already queued jobs. It takes one of <literal>fail</literal>,
259 <literal>replace</literal>,
260 <literal>replace-irreversibly</literal>,
261 <literal>isolate</literal>,
262 <literal>ignore-dependencies</literal>,
263 <literal>ignore-requirements</literal> or
264 <literal>flush</literal>. Defaults to
265 <literal>replace</literal>, except when the
266 <command>isolate</command> command is used which implies the
267 <literal>isolate</literal> job mode.</para>
268
269 <para>If <literal>fail</literal> is specified and a requested
270 operation conflicts with a pending job (more specifically:
271 causes an already pending start job to be reversed into a stop
272 job or vice versa), cause the operation to fail.</para>
273
274 <para>If <literal>replace</literal> (the default) is
275 specified, any conflicting pending job will be replaced, as
276 necessary.</para>
277
278 <para>If <literal>replace-irreversibly</literal> is specified,
279 operate like <literal>replace</literal>, but also mark the new
280 jobs as irreversible. This prevents future conflicting
281 transactions from replacing these jobs (or even being enqueued
282 while the irreversible jobs are still pending). Irreversible
283 jobs can still be cancelled using the <command>cancel</command>
284 command.</para>
285
286 <para><literal>isolate</literal> is only valid for start
287 operations and causes all other units to be stopped when the
288 specified unit is started. This mode is always used when the
289 <command>isolate</command> command is used.</para>
290
291 <para><literal>flush</literal> will cause all queued jobs to
292 be canceled when the new job is enqueued.</para>
293
294 <para>If <literal>ignore-dependencies</literal> is specified,
295 then all unit dependencies are ignored for this new job and
296 the operation is executed immediately. If passed, no required
297 units of the unit passed will be pulled in, and no ordering
298 dependencies will be honored. This is mostly a debugging and
299 rescue tool for the administrator and should not be used by
300 applications.</para>
301
302 <para><literal>ignore-requirements</literal> is similar to
303 <literal>ignore-dependencies</literal>, but only causes the
304 requirement dependencies to be ignored, the ordering
305 dependencies will still be honoured.</para>
306 </listitem>
307
308 </varlistentry>
309
310 <varlistentry>
311 <term><option>--fail</option></term>
312
313 <listitem>
314 <para>Shorthand for <option>--job-mode=</option>fail.</para>
315 <para>When used with the <command>kill</command> command,
316 if no units were killed, the operation results in an error.
317 </para>
318 </listitem>
319 </varlistentry>
320
321 <varlistentry>
322 <term><option>-i</option></term>
323 <term><option>--ignore-inhibitors</option></term>
324
325 <listitem>
326 <para>When system shutdown or a sleep state is requested,
327 ignore inhibitor locks. Applications can establish inhibitor
328 locks to avoid that certain important operations (such as CD
329 burning or suchlike) are interrupted by system shutdown or a
330 sleep state. Any user may take these locks and privileged
331 users may override these locks. If any locks are taken,
332 shutdown and sleep state requests will normally fail
333 (regardless of whether privileged or not) and a list of active locks
334 is printed. However, if <option>--ignore-inhibitors</option>
335 is specified, the locks are ignored and not printed, and the
336 operation attempted anyway, possibly requiring additional
337 privileges.</para>
338 </listitem>
339 </varlistentry>
340
341 <varlistentry>
342 <term><option>-q</option></term>
343 <term><option>--quiet</option></term>
344
345 <listitem>
346 <para>Suppress printing of the results of various commands
347 and also the hints about truncated log lines. This does not
348 suppress output of commands for which the printed output is
349 the only result (like <command>show</command>). Errors are
350 always printed.</para>
351 </listitem>
352 </varlistentry>
353
354 <varlistentry>
355 <term><option>--no-block</option></term>
356
357 <listitem>
358 <para>Do not synchronously wait for the requested operation
359 to finish. If this is not specified, the job will be
360 verified, enqueued and <command>systemctl</command> will
361 wait until the unit's start-up is completed. By passing this
362 argument, it is only verified and enqueued.</para>
363 </listitem>
364 </varlistentry>
365
366 <xi:include href="user-system-options.xml" xpointer="user" />
367 <xi:include href="user-system-options.xml" xpointer="system" />
368
369 <!-- we do not document -failed here, as it has been made
370 redundant by -state=failed, which it predates. To keep
371 things simple, we only document the new switch, while
372 keeping the old one around for compatibility only. -->
373
374 <varlistentry>
375 <term><option>--no-wall</option></term>
376
377 <listitem>
378 <para>Do not send wall message before halt, power-off,
379 reboot.</para>
380 </listitem>
381 </varlistentry>
382
383 <varlistentry>
384 <term><option>--global</option></term>
385
386 <listitem>
387 <para>When used with <command>enable</command> and
388 <command>disable</command>, operate on the global user
389 configuration directory, thus enabling or disabling a unit
390 file globally for all future logins of all users.</para>
391 </listitem>
392 </varlistentry>
393
394 <varlistentry>
395 <term><option>--no-reload</option></term>
396
397 <listitem>
398 <para>When used with <command>enable</command> and
399 <command>disable</command>, do not implicitly reload daemon
400 configuration after executing the changes.</para>
401 </listitem>
402 </varlistentry>
403
404 <varlistentry>
405 <term><option>--no-ask-password</option></term>
406
407 <listitem>
408 <para>When used with <command>start</command> and related
409 commands, disables asking for passwords. Background services
410 may require input of a password or passphrase string, for
411 example to unlock system hard disks or cryptographic
412 certificates. Unless this option is specified and the
413 command is invoked from a terminal,
414 <command>systemctl</command> will query the user on the
415 terminal for the necessary secrets. Use this option to
416 switch this behavior off. In this case, the password must be
417 supplied by some other means (for example graphical password
418 agents) or the service might fail. This also disables
419 querying the user for authentication for privileged
420 operations.</para>
421 </listitem>
422 </varlistentry>
423
424 <varlistentry>
425 <term><option>--kill-who=</option></term>
426
427 <listitem>
428 <para>When used with <command>kill</command>, choose which
429 processes to send a signal to. Must be one of
430 <option>main</option>, <option>control</option> or
431 <option>all</option> to select whether to kill only the main
432 process, the control process or all processes of the
433 unit. The main process of the unit is the one that defines
434 the life-time of it. A control process of a unit is one that
435 is invoked by the manager to induce state changes of it. For
436 example, all processes started due to the
437 <varname>ExecStartPre=</varname>,
438 <varname>ExecStop=</varname> or
439 <varname>ExecReload=</varname> settings of service units are
440 control processes. Note that there is only one control
441 process per unit at a time, as only one state change is
442 executed at a time. For services of type
443 <varname>Type=forking</varname>, the initial process started
444 by the manager for <varname>ExecStart=</varname> is a
445 control process, while the process ultimately forked off by
446 that one is then considered the main process of the unit (if
447 it can be determined). This is different for service units
448 of other types, where the process forked off by the manager
449 for <varname>ExecStart=</varname> is always the main process
450 itself. A service unit consists of zero or one main process,
451 zero or one control process plus any number of additional
452 processes. Not all unit types manage processes of these
453 types however. For example, for mount units, control processes
454 are defined (which are the invocations of
455 <filename>&MOUNT_PATH;</filename> and
456 <filename>&UMOUNT_PATH;</filename>), but no main process
457 is defined. If omitted, defaults to
458 <option>all</option>.</para>
459 </listitem>
460
461 </varlistentry>
462
463 <varlistentry>
464 <term><option>-s</option></term>
465 <term><option>--signal=</option></term>
466
467 <listitem>
468 <para>When used with <command>kill</command>, choose which
469 signal to send to selected processes. Must be one of the
470 well-known signal specifiers such as <constant>SIGTERM</constant>, <constant>SIGINT</constant> or
471 <constant>SIGSTOP</constant>. If omitted, defaults to
472 <option>SIGTERM</option>.</para>
473 </listitem>
474 </varlistentry>
475
476 <varlistentry>
477 <term><option>-f</option></term>
478 <term><option>--force</option></term>
479
480 <listitem>
481 <para>When used with <command>enable</command>, overwrite
482 any existing conflicting symlinks.</para>
483
484 <para>When used with <command>halt</command>,
485 <command>poweroff</command>, <command>reboot</command> or
486 <command>kexec</command>, execute the selected operation
487 without shutting down all units. However, all processes will
488 be killed forcibly and all file systems are unmounted or
489 remounted read-only. This is hence a drastic but relatively
490 safe option to request an immediate reboot. If
491 <option>--force</option> is specified twice for these
492 operations, they will be executed immediately without
493 terminating any processes or unmounting any file
494 systems. Warning: specifying <option>--force</option> twice
495 with any of these operations might result in data
496 loss.</para>
497 </listitem>
498 </varlistentry>
499
500 <varlistentry>
501 <term><option>--message=</option></term>
502
503 <listitem>
504 <para>When used with <command>halt</command>,
505 <command>poweroff</command>, <command>reboot</command> or
506 <command>kexec</command>, set a short message explaining the reason
507 for the operation. The message will be logged together with the
508 default shutdown message.</para>
509 </listitem>
510 </varlistentry>
511
512 <varlistentry>
513 <term><option>--now</option></term>
514
515 <listitem>
516 <para>When used with <command>enable</command>, the units
517 will also be started. When used with <command>disable</command> or
518 <command>mask</command>, the units will also be stopped. The start
519 or stop operation is only carried out when the respective enable or
520 disable operation has been successful.</para>
521 </listitem>
522 </varlistentry>
523
524 <varlistentry>
525 <term><option>--root=</option></term>
526
527 <listitem>
528 <para>When used with
529 <command>enable</command>/<command>disable</command>/<command>is-enabled</command>
530 (and related commands), use an alternate root path when
531 looking for unit files.</para>
532 </listitem>
533
534 </varlistentry>
535
536 <varlistentry>
537 <term><option>--runtime</option></term>
538
539 <listitem>
540 <para>When used with <command>enable</command>,
541 <command>disable</command>, <command>edit</command>,
542 (and related commands), make changes only temporarily, so
543 that they are lost on the next reboot. This will have the
544 effect that changes are not made in subdirectories of
545 <filename>/etc</filename> but in <filename>/run</filename>,
546 with identical immediate effects, however, since the latter
547 is lost on reboot, the changes are lost too.</para>
548
549 <para>Similarly, when used with
550 <command>set-property</command>, make changes only
551 temporarily, so that they are lost on the next
552 reboot.</para>
553 </listitem>
554 </varlistentry>
555
556 <varlistentry>
557 <term><option>--preset-mode=</option></term>
558
559 <listitem>
560 <para>Takes one of <literal>full</literal> (the default),
561 <literal>enable-only</literal>,
562 <literal>disable-only</literal>. When used with the
563 <command>preset</command> or <command>preset-all</command>
564 commands, controls whether units shall be disabled and
565 enabled according to the preset rules, or only enabled, or
566 only disabled.</para>
567 </listitem>
568 </varlistentry>
569
570 <varlistentry>
571 <term><option>-n</option></term>
572 <term><option>--lines=</option></term>
573
574 <listitem>
575 <para>When used with <command>status</command>, controls the
576 number of journal lines to show, counting from the most
577 recent ones. Takes a positive integer argument. Defaults to
578 10.</para>
579 </listitem>
580 </varlistentry>
581
582 <varlistentry>
583 <term><option>-o</option></term>
584 <term><option>--output=</option></term>
585
586 <listitem>
587 <para>When used with <command>status</command>, controls the
588 formatting of the journal entries that are shown. For the
589 available choices, see
590 <citerefentry><refentrytitle>journalctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
591 Defaults to <literal>short</literal>.</para>
592 </listitem>
593 </varlistentry>
594
595 <varlistentry>
596 <term><option>--firmware-setup</option></term>
597
598 <listitem>
599 <para>When used with the <command>reboot</command> command,
600 indicate to the system's firmware to boot into setup
601 mode. Note that this is currently only supported on some EFI
602 systems and only if the system was booted in EFI
603 mode.</para>
604 </listitem>
605 </varlistentry>
606
607 <varlistentry>
608 <term><option>--plain</option></term>
609
610 <listitem>
611 <para>When used with <command>list-dependencies</command>,
612 <command>list-units</command> or <command>list-machines</command>, the
613 the output is printed as a list instead of a tree, and the bullet
614 circles are omitted.</para>
615 </listitem>
616 </varlistentry>
617
618 <xi:include href="user-system-options.xml" xpointer="host" />
619 <xi:include href="user-system-options.xml" xpointer="machine" />
620
621 <xi:include href="standard-options.xml" xpointer="no-pager" />
622 <xi:include href="standard-options.xml" xpointer="no-legend" />
623 <xi:include href="standard-options.xml" xpointer="help" />
624 <xi:include href="standard-options.xml" xpointer="version" />
625 </variablelist>
626 </refsect1>
627
628 <refsect1>
629 <title>Commands</title>
630
631 <para>The following commands are understood:</para>
632
633 <refsect2>
634 <title>Unit Commands</title>
635
636 <variablelist>
637 <varlistentry>
638 <term><command>list-units <optional><replaceable>PATTERN</replaceable>...</optional></command></term>
639
640 <listitem>
641 <para>List known units (subject to limitations specified
642 with <option>-t</option>). If one or more
643 <replaceable>PATTERN</replaceable>s are specified, only
644 units matching one of them are shown.</para>
645
646 <para>This is the default command.</para>
647 </listitem>
648 </varlistentry>
649
650 <varlistentry>
651 <term><command>list-sockets <optional><replaceable>PATTERN</replaceable>...</optional></command></term>
652
653 <listitem>
654 <para>List socket units ordered by listening address.
655 If one or more <replaceable>PATTERN</replaceable>s are
656 specified, only socket units matching one of them are
657 shown. Produces output similar to
658 <programlisting>
659 LISTEN UNIT ACTIVATES
660 /dev/initctl systemd-initctl.socket systemd-initctl.service
661 ...
662 [::]:22 sshd.socket sshd.service
663 kobject-uevent 1 systemd-udevd-kernel.socket systemd-udevd.service
664
665 5 sockets listed.</programlisting>
666 Note: because the addresses might contains spaces, this output
667 is not suitable for programmatic consumption.
668 </para>
669
670 <para>See also the options <option>--show-types</option>,
671 <option>--all</option>, and <option>--state=</option>.</para>
672 </listitem>
673 </varlistentry>
674
675 <varlistentry>
676 <term><command>list-timers <optional><replaceable>PATTERN</replaceable>...</optional></command></term>
677
678 <listitem>
679 <para>List timer units ordered by the time they elapse
680 next. If one or more <replaceable>PATTERN</replaceable>s
681 are specified, only units matching one of them are shown.
682 </para>
683
684 <para>See also the options <option>--all</option> and
685 <option>--state=</option>.</para>
686 </listitem>
687 </varlistentry>
688
689 <varlistentry>
690 <term><command>start <replaceable>PATTERN</replaceable>...</command></term>
691
692 <listitem>
693 <para>Start (activate) one or more units specified on the
694 command line.</para>
695
696 <para>Note that glob patterns operate on the set of primary names of currently loaded units. Units which
697 are not active and are not in a failed state usually are not loaded, and will not be matched by any
698 pattern. In addition, in case of instantiated units, systemd is often unaware of the instance name until
699 the instance has been started. Therefore, using glob patterns with <command>start</command> has limited
700 usefulness. Also, secondary alias names of units are not considered.</para>
701 </listitem>
702 </varlistentry>
703 <varlistentry>
704 <term><command>stop <replaceable>PATTERN</replaceable>...</command></term>
705
706 <listitem>
707 <para>Stop (deactivate) one or more units specified on the
708 command line.</para>
709 </listitem>
710 </varlistentry>
711 <varlistentry>
712 <term><command>reload <replaceable>PATTERN</replaceable>...</command></term>
713
714 <listitem>
715 <para>Asks all units listed on the command line to reload
716 their configuration. Note that this will reload the
717 service-specific configuration, not the unit configuration
718 file of systemd. If you want systemd to reload the
719 configuration file of a unit, use the
720 <command>daemon-reload</command> command. In other words:
721 for the example case of Apache, this will reload Apache's
722 <filename>httpd.conf</filename> in the web server, not the
723 <filename>apache.service</filename> systemd unit
724 file.</para>
725
726 <para>This command should not be confused with the
727 <command>daemon-reload</command> command.</para>
728 </listitem>
729
730 </varlistentry>
731 <varlistentry>
732 <term><command>restart <replaceable>PATTERN</replaceable>...</command></term>
733
734 <listitem>
735 <para>Restart one or more units specified on the command
736 line. If the units are not running yet, they will be
737 started.</para>
738 </listitem>
739 </varlistentry>
740 <varlistentry>
741 <term><command>try-restart <replaceable>PATTERN</replaceable>...</command></term>
742
743 <listitem>
744 <para>Restart one or more units specified on the command
745 line if the units are running. This does nothing if units are not
746 running.</para>
747 <!-- Note that we don't document condrestart here, as that is just compatibility support, and we generally
748 don't document that. -->
749 </listitem>
750 </varlistentry>
751 <varlistentry>
752 <term><command>reload-or-restart <replaceable>PATTERN</replaceable>...</command></term>
753
754 <listitem>
755 <para>Reload one or more units if they support it. If not,
756 restart them instead. If the units are not running yet, they
757 will be started.</para>
758 </listitem>
759 </varlistentry>
760 <varlistentry>
761 <term><command>try-reload-or-restart <replaceable>PATTERN</replaceable>...</command></term>
762
763 <listitem>
764 <para>Reload one or more units if they support it. If not,
765 restart them instead. This does nothing if the units are not
766 running.</para>
767 <!-- Note that we don't document force-reload here, as that is just compatibility support, and we generally
768 don't document that. -->
769 </listitem>
770 </varlistentry>
771 <varlistentry>
772 <term><command>isolate <replaceable>NAME</replaceable></command></term>
773
774 <listitem>
775 <para>Start the unit specified on the command line and its
776 dependencies and stop all others. If a unit name with no
777 extension is given, an extension of
778 <literal>.target</literal> will be assumed.</para>
779
780 <para>This is similar to changing the runlevel in a
781 traditional init system. The <command>isolate</command>
782 command will immediately stop processes that are not enabled
783 in the new unit, possibly including the graphical
784 environment or terminal you are currently using.</para>
785
786 <para>Note that this is allowed only on units where
787 <option>AllowIsolate=</option> is enabled. See
788 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
789 for details.</para>
790 </listitem>
791 </varlistentry>
792 <varlistentry>
793 <term><command>kill <replaceable>PATTERN</replaceable>...</command></term>
794
795 <listitem>
796 <para>Send a signal to one or more processes of the
797 unit. Use <option>--kill-who=</option> to select which
798 process to kill. Use <option>--signal=</option> to select
799 the signal to send.</para>
800 </listitem>
801 </varlistentry>
802 <varlistentry>
803 <term><command>is-active <replaceable>PATTERN</replaceable>...</command></term>
804
805 <listitem>
806 <para>Check whether any of the specified units are active
807 (i.e. running). Returns an exit code
808 <constant>0</constant> if at least one is active, or
809 non-zero otherwise. Unless <option>--quiet</option> is
810 specified, this will also print the current unit state to
811 standard output.</para>
812 </listitem>
813 </varlistentry>
814 <varlistentry>
815 <term><command>is-failed <replaceable>PATTERN</replaceable>...</command></term>
816
817 <listitem>
818 <para>Check whether any of the specified units are in a
819 "failed" state. Returns an exit code
820 <constant>0</constant> if at least one has failed,
821 non-zero otherwise. Unless <option>--quiet</option> is
822 specified, this will also print the current unit state to
823 standard output.</para>
824 </listitem>
825 </varlistentry>
826 <varlistentry>
827 <term><command>status</command> <optional><replaceable>PATTERN</replaceable>...|<replaceable>PID</replaceable>...]</optional></term>
828
829 <listitem>
830 <para>Show terse runtime status information about one or
831 more units, followed by most recent log data from the
832 journal. If no units are specified, show system status. If
833 combined with <option>--all</option>, also show the status of
834 all units (subject to limitations specified with
835 <option>-t</option>). If a PID is passed, show information
836 about the unit the process belongs to.</para>
837
838 <para>This function is intended to generate human-readable
839 output. If you are looking for computer-parsable output,
840 use <command>show</command> instead. By default, this
841 function only shows 10 lines of output and ellipsizes
842 lines to fit in the terminal window. This can be changed
843 with <option>--lines</option> and <option>--full</option>,
844 see above. In addition, <command>journalctl
845 --unit=<replaceable>NAME</replaceable></command> or
846 <command>journalctl
847 --user-unit=<replaceable>NAME</replaceable></command> use
848 a similar filter for messages and might be more
849 convenient.
850 </para>
851 </listitem>
852 </varlistentry>
853 <varlistentry>
854 <term><command>show</command> <optional><replaceable>PATTERN</replaceable>...|<replaceable>JOB</replaceable>...</optional></term>
855
856 <listitem>
857 <para>Show properties of one or more units, jobs, or the
858 manager itself. If no argument is specified, properties of
859 the manager will be shown. If a unit name is specified,
860 properties of the unit is shown, and if a job ID is
861 specified, properties of the job is shown. By default, empty
862 properties are suppressed. Use <option>--all</option> to
863 show those too. To select specific properties to show, use
864 <option>--property=</option>. This command is intended to be
865 used whenever computer-parsable output is required. Use
866 <command>status</command> if you are looking for formatted
867 human-readable output.</para>
868 </listitem>
869 </varlistentry>
870 <varlistentry>
871 <term><command>cat <replaceable>PATTERN</replaceable>...</command></term>
872
873 <listitem>
874 <para>Show backing files of one or more units. Prints the
875 "fragment" and "drop-ins" (source files) of units. Each
876 file is preceded by a comment which includes the file
877 name.</para>
878 </listitem>
879 </varlistentry>
880 <varlistentry>
881 <term><command>set-property <replaceable>NAME</replaceable> <replaceable>ASSIGNMENT</replaceable>...</command></term>
882
883 <listitem>
884 <para>Set the specified unit properties at runtime where
885 this is supported. This allows changing configuration
886 parameter properties such as resource control settings at
887 runtime. Not all properties may be changed at runtime, but
888 many resource control settings (primarily those in
889 <citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>)
890 may. The changes are applied instantly, and stored on disk
891 for future boots, unless <option>--runtime</option> is
892 passed, in which case the settings only apply until the
893 next reboot. The syntax of the property assignment follows
894 closely the syntax of assignments in unit files.</para>
895
896 <para>Example: <command>systemctl set-property foobar.service CPUShares=777</command></para>
897
898 <para>If the specified unit appears to be inactive, the
899 changes will be only stored on disk as described
900 previously hence they will be effective when the unit will
901 be started.</para>
902
903 <para>Note that this command allows changing multiple
904 properties at the same time, which is preferable over
905 setting them individually. Like unit file configuration
906 settings, assigning the empty list to list parameters will
907 reset the list.</para>
908 </listitem>
909 </varlistentry>
910
911 <varlistentry>
912 <term><command>help <replaceable>PATTERN</replaceable>...|<replaceable>PID</replaceable>...</command></term>
913
914 <listitem>
915 <para>Show manual pages for one or more units, if
916 available. If a PID is given, the manual pages for the unit
917 the process belongs to are shown.</para>
918 </listitem>
919 </varlistentry>
920
921 <varlistentry>
922 <term><command>reset-failed [<replaceable>PATTERN</replaceable>...]</command></term>
923
924 <listitem>
925 <para>Reset the <literal>failed</literal> state of the
926 specified units, or if no unit name is passed, reset the state of all
927 units. When a unit fails in some way (i.e. process exiting
928 with non-zero error code, terminating abnormally or timing
929 out), it will automatically enter the
930 <literal>failed</literal> state and its exit code and status
931 is recorded for introspection by the administrator until the
932 service is restarted or reset with this command.</para>
933 </listitem>
934 </varlistentry>
935
936 <varlistentry>
937 <term>
938 <command>list-dependencies</command>
939 <optional><replaceable>NAME</replaceable></optional>
940 </term>
941
942 <listitem>
943 <para>Shows units required and wanted by the specified
944 unit. This recursively lists units following the
945 <varname>Requires=</varname>,
946 <varname>Requisite=</varname>,
947 <varname>ConsistsOf=</varname>,
948 <varname>Wants=</varname>, <varname>BindsTo=</varname>
949 dependencies. If no unit is specified,
950 <filename>default.target</filename> is implied.</para>
951
952 <para>By default, only target units are recursively
953 expanded. When <option>--all</option> is passed, all other
954 units are recursively expanded as well.</para>
955
956 <para>Options <option>--reverse</option>,
957 <option>--after</option>, <option>--before</option>
958 may be used to change what types of dependencies
959 are shown.</para>
960 </listitem>
961 </varlistentry>
962 </variablelist>
963 </refsect2>
964
965 <refsect2>
966 <title>Unit File Commands</title>
967
968 <variablelist>
969 <varlistentry>
970 <term><command>list-unit-files <optional><replaceable>PATTERN...</replaceable></optional></command></term>
971
972 <listitem>
973 <para>List installed unit files and their enablement state
974 (as reported by <command>is-enabled</command>). If one or
975 more <replaceable>PATTERN</replaceable>s are specified,
976 only units whose filename (just the last component of the
977 path) matches one of them are shown.</para>
978 </listitem>
979 </varlistentry>
980
981 <varlistentry>
982 <term><command>enable <replaceable>NAME</replaceable>...</command></term>
983
984 <listitem>
985 <para>Enable one or more unit files or unit file instances,
986 as specified on the command line. This will create a number
987 of symlinks as encoded in the <literal>[Install]</literal>
988 sections of the unit files. After the symlinks have been
989 created, the systemd configuration is reloaded (in a way that
990 is equivalent to <command>daemon-reload</command>) to ensure
991 the changes are taken into account immediately. Note that
992 this does <emphasis>not</emphasis> have the effect of also
993 starting any of the units being enabled. If this
994 is desired, either <option>--now</option> should be used
995 together with this command, or an additional <command>start</command>
996 command must be invoked for the unit. Also note that, in case of
997 instance enablement, symlinks named the same as instances
998 are created in the install location, however they all point to the
999 same template unit file.</para>
1000
1001 <para>This command will print the actions executed. This
1002 output may be suppressed by passing <option>--quiet</option>.
1003 </para>
1004
1005 <para>Note that this operation creates only the suggested
1006 symlinks for the units. While this command is the
1007 recommended way to manipulate the unit configuration
1008 directory, the administrator is free to make additional
1009 changes manually by placing or removing symlinks in the
1010 directory. This is particularly useful to create
1011 configurations that deviate from the suggested default
1012 installation. In this case, the administrator must make sure
1013 to invoke <command>daemon-reload</command> manually as
1014 necessary to ensure the changes are taken into account.
1015 </para>
1016
1017 <para>Enabling units should not be confused with starting
1018 (activating) units, as done by the <command>start</command>
1019 command. Enabling and starting units is orthogonal: units
1020 may be enabled without being started and started without
1021 being enabled. Enabling simply hooks the unit into various
1022 suggested places (for example, so that the unit is
1023 automatically started on boot or when a particular kind of
1024 hardware is plugged in). Starting actually spawns the daemon
1025 process (in case of service units), or binds the socket (in
1026 case of socket units), and so on.</para>
1027
1028 <para>Depending on whether <option>--system</option>,
1029 <option>--user</option>, <option>--runtime</option>,
1030 or <option>--global</option> is specified, this enables the unit
1031 for the system, for the calling user only, for only this boot of
1032 the system, or for all future logins of all users, or only this
1033 boot. Note that in the last case, no systemd daemon
1034 configuration is reloaded.</para>
1035
1036 <para>Using <command>enable</command> on masked units
1037 results in an error.</para>
1038 </listitem>
1039 </varlistentry>
1040
1041 <varlistentry>
1042 <term><command>disable <replaceable>NAME</replaceable>...</command></term>
1043
1044 <listitem>
1045 <para>Disables one or more units. This removes all symlinks
1046 to the specified unit files from the unit configuration
1047 directory, and hence undoes the changes made by
1048 <command>enable</command>. Note however that this removes
1049 all symlinks to the unit files (i.e. including manual
1050 additions), not just those actually created by
1051 <command>enable</command>. This call implicitly reloads the
1052 systemd daemon configuration after completing the disabling
1053 of the units. Note that this command does not implicitly
1054 stop the units that are being disabled. If this is desired, either
1055 <option>--now</option> should be used together with this command, or
1056 an additional <command>stop</command> command should be executed
1057 afterwards.</para>
1058
1059 <para>This command will print the actions executed. This
1060 output may be suppressed by passing <option>--quiet</option>.
1061 </para>
1062
1063 <para>This command honors <option>--system</option>,
1064 <option>--user</option>, <option>--runtime</option> and
1065 <option>--global</option> in a similar way as
1066 <command>enable</command>.</para>
1067 </listitem>
1068 </varlistentry>
1069
1070 <varlistentry>
1071 <term><command>reenable <replaceable>NAME</replaceable>...</command></term>
1072
1073 <listitem>
1074 <para>Reenable one or more unit files, as specified on the
1075 command line. This is a combination of
1076 <command>disable</command> and <command>enable</command> and
1077 is useful to reset the symlinks a unit is enabled with to
1078 the defaults configured in the <literal>[Install]</literal>
1079 section of the unit file.</para>
1080 </listitem>
1081 </varlistentry>
1082
1083 <varlistentry>
1084 <term><command>preset <replaceable>NAME</replaceable>...</command></term>
1085
1086 <listitem>
1087 <para>Reset one or more unit files, as specified on the
1088 command line, to the defaults configured in the preset
1089 policy files. This has the same effect as
1090 <command>disable</command> or <command>enable</command>,
1091 depending how the unit is listed in the preset files.</para>
1092
1093 <para>Use <option>--preset-mode=</option> to control
1094 whether units shall be enabled and disabled, or only
1095 enabled, or only disabled.</para>
1096
1097 <para>For more information on the preset policy format,
1098 see
1099 <citerefentry><refentrytitle>systemd.preset</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
1100 For more information on the concept of presets, please
1101 consult the <ulink
1102 url="http://freedesktop.org/wiki/Software/systemd/Preset">Preset</ulink>
1103 document.</para>
1104 </listitem>
1105 </varlistentry>
1106
1107 <varlistentry>
1108 <term><command>preset-all</command></term>
1109
1110 <listitem>
1111 <para>Resets all installed unit files to the defaults
1112 configured in the preset policy file (see above).</para>
1113
1114 <para>Use <option>--preset-mode=</option> to control
1115 whether units shall be enabled and disabled, or only
1116 enabled, or only disabled.</para>
1117 </listitem>
1118 </varlistentry>
1119
1120 <varlistentry>
1121 <term><command>is-enabled <replaceable>NAME</replaceable>...</command></term>
1122
1123 <listitem>
1124 <para>Checks whether any of the specified unit files are
1125 enabled (as with <command>enable</command>). Returns an
1126 exit code of 0 if at least one is enabled, non-zero
1127 otherwise. Prints the current enable status (see table).
1128 To suppress this output, use <option>--quiet</option>.
1129 </para>
1130
1131 <table>
1132 <title>
1133 <command>is-enabled</command> output
1134 </title>
1135
1136 <tgroup cols='3'>
1137 <thead>
1138 <row>
1139 <entry>Name</entry>
1140 <entry>Description</entry>
1141 <entry>Exit Code</entry>
1142 </row>
1143 </thead>
1144 <tbody>
1145 <row>
1146 <entry><literal>enabled</literal></entry>
1147 <entry morerows='1'>Enabled via <filename>.wants/</filename>, <filename>.requires/</filename> or alias symlinks (permanently in <filename>/etc/systemd/system/</filename>, or transiently in <filename>/run/systemd/system/</filename>).</entry>
1148 <entry morerows='1'>0</entry>
1149 </row>
1150 <row>
1151 <entry><literal>enabled-runtime</literal></entry>
1152 </row>
1153 <row>
1154 <entry><literal>linked</literal></entry>
1155 <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>
1156 <entry morerows='1'>&gt; 0</entry>
1157 </row>
1158 <row>
1159 <entry><literal>linked-runtime</literal></entry>
1160 </row>
1161 <row>
1162 <entry><literal>masked</literal></entry>
1163 <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>
1164 <entry morerows='1'>&gt; 0</entry>
1165 </row>
1166 <row>
1167 <entry><literal>masked-runtime</literal></entry>
1168 </row>
1169 <row>
1170 <entry><literal>static</literal></entry>
1171 <entry>The unit file is not enabled, and has no provisions for enabling in the <literal>[Install]</literal> unit file section.</entry>
1172 <entry>0</entry>
1173 </row>
1174 <row>
1175 <entry><literal>indirect</literal></entry>
1176 <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.</entry>
1177 <entry>0</entry>
1178 </row>
1179 <row>
1180 <entry><literal>disabled</literal></entry>
1181 <entry>The unit file is not enabled, but contains an <literal>[Install]</literal> section with installation instructions.</entry>
1182 <entry>&gt; 0</entry>
1183 </row>
1184 <row>
1185 <entry><literal>generated</literal></entry>
1186 <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>
1187 <entry>0</entry>
1188 </row>
1189 <row>
1190 <entry><literal>transient</literal></entry>
1191 <entry>The unit file has been created dynamically with the runtime API. Transient units may not be enabled.</entry>
1192 <entry>0</entry>
1193 </row>
1194 <row>
1195 <entry><literal>bad</literal></entry>
1196 <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>
1197 <entry>&gt; 0</entry>
1198 </row>
1199 </tbody>
1200 </tgroup>
1201 </table>
1202
1203 </listitem>
1204 </varlistentry>
1205
1206 <varlistentry>
1207 <term><command>mask <replaceable>NAME</replaceable>...</command></term>
1208
1209 <listitem>
1210 <para>Mask one or more unit files, as specified on the
1211 command line. This will link these units to
1212 <filename>/dev/null</filename>, making it impossible to
1213 start them. This is a stronger version of
1214 <command>disable</command>, since it prohibits all kinds of
1215 activation of the unit, including enablement and manual
1216 activation. Use this option with care. This honors the
1217 <option>--runtime</option> option to only mask temporarily
1218 until the next reboot of the system. The <option>--now</option>
1219 option can be used to ensure that the units are also stopped.</para>
1220 </listitem>
1221 </varlistentry>
1222
1223 <varlistentry>
1224 <term><command>unmask <replaceable>NAME</replaceable>...</command></term>
1225
1226 <listitem>
1227 <para>Unmask one or more unit files, as specified on the
1228 command line. This will undo the effect of
1229 <command>mask</command>.</para>
1230 </listitem>
1231 </varlistentry>
1232
1233 <varlistentry>
1234 <term><command>link <replaceable>FILENAME</replaceable>...</command></term>
1235
1236 <listitem>
1237 <para>Link a unit file that is not in the unit file search
1238 paths into the unit file search path. This requires an
1239 absolute path to a unit file. The effect of this can be
1240 undone with <command>disable</command>. The effect of this
1241 command is that a unit file is available for
1242 <command>start</command> and other commands although it
1243 is not installed directly in the unit search path.</para>
1244 </listitem>
1245 </varlistentry>
1246
1247 <varlistentry>
1248 <term><command>revert <replaceable>NAME</replaceable>...</command></term>
1249
1250 <listitem>
1251 <para>Revert one or more unit files to their vendor versions. This command removes drop-in configuration
1252 files that modify the specified units, as well as any user-configured unit file that overrides a matching
1253 vendor supplied unit file. Specifically, for a unit <literal>foo.service</literal> the matching directories
1254 <literal>foo.service.d/</literal> with all their contained files are removed, both below the persistent and
1255 runtime configuration directories (i.e. below <filename>/etc/systemd/system</filename> and
1256 <filename>/run/systemd/system</filename>); if the unit file has a vendor-supplied version (i.e. a unit file
1257 located below <filename>/usr</filename>) any matching peristent or runtime unit file that overrides it is
1258 removed, too. Note that if a unit file has no vendor-supplied version (i.e. is only defined below
1259 <filename>/etc/systemd/system</filename> or <filename>/run/systemd/system</filename>, but not in a unit
1260 file stored below <filename>/usr</filename>), then it is not removed. Also, if a unit is masked, it is
1261 unmasked.</para>
1262
1263 <para>Effectively, this command may be used to undo all changes made with <command>systemctl
1264 edit</command>, <command>systemctl set-property</command> and <command>systemctl mask</command> and puts
1265 the original unit file with its settings back in effect.</para>
1266 </listitem>
1267 </varlistentry>
1268
1269 <varlistentry>
1270 <term><command>add-wants <replaceable>TARGET</replaceable>
1271 <replaceable>NAME</replaceable>...</command></term>
1272 <term><command>add-requires <replaceable>TARGET</replaceable>
1273 <replaceable>NAME</replaceable>...</command></term>
1274
1275 <listitem>
1276 <para>Adds <literal>Wants=</literal> or <literal>Requires=</literal>
1277 dependencies, respectively, to the specified
1278 <replaceable>TARGET</replaceable> for one or more units. </para>
1279
1280 <para>This command honors <option>--system</option>,
1281 <option>--user</option>, <option>--runtime</option> and
1282 <option>--global</option> in a way similar to
1283 <command>enable</command>.</para>
1284
1285 </listitem>
1286 </varlistentry>
1287
1288 <varlistentry>
1289 <term><command>edit <replaceable>NAME</replaceable>...</command></term>
1290
1291 <listitem>
1292 <para>Edit a drop-in snippet or a whole replacement file if
1293 <option>--full</option> is specified, to extend or override the
1294 specified unit.</para>
1295
1296 <para>Depending on whether <option>--system</option> (the default),
1297 <option>--user</option>, or <option>--global</option> is specified,
1298 this command creates a drop-in file for each unit either for the system,
1299 for the calling user, or for all futures logins of all users. Then,
1300 the editor (see the "Environment" section below) is invoked on
1301 temporary files which will be written to the real location if the
1302 editor exits successfully.</para>
1303
1304 <para>If <option>--full</option> is specified, this will copy the
1305 original units instead of creating drop-in files.</para>
1306
1307 <para>If <option>--runtime</option> is specified, the changes will
1308 be made temporarily in <filename>/run</filename> and they will be
1309 lost on the next reboot.</para>
1310
1311 <para>If the temporary file is empty upon exit, the modification of
1312 the related unit is canceled.</para>
1313
1314 <para>After the units have been edited, systemd configuration is
1315 reloaded (in a way that is equivalent to <command>daemon-reload</command>).
1316 </para>
1317
1318 <para>Note that this command cannot be used to remotely edit units
1319 and that you cannot temporarily edit units which are in
1320 <filename>/etc</filename>, since they take precedence over
1321 <filename>/run</filename>.</para>
1322 </listitem>
1323 </varlistentry>
1324
1325 <varlistentry>
1326 <term><command>get-default</command></term>
1327
1328 <listitem>
1329 <para>Return the default target to boot into. This returns
1330 the target unit name <filename>default.target</filename>
1331 is aliased (symlinked) to.</para>
1332 </listitem>
1333 </varlistentry>
1334
1335 <varlistentry>
1336 <term><command>set-default <replaceable>NAME</replaceable></command></term>
1337
1338 <listitem>
1339 <para>Set the default target to boot into. This sets
1340 (symlinks) the <filename>default.target</filename> alias
1341 to the given target unit.</para>
1342 </listitem>
1343 </varlistentry>
1344
1345 </variablelist>
1346 </refsect2>
1347
1348 <refsect2>
1349 <title>Machine Commands</title>
1350
1351 <variablelist>
1352 <varlistentry>
1353 <term><command>list-machines <optional><replaceable>PATTERN</replaceable>...</optional></command></term>
1354
1355 <listitem>
1356 <para>List the host and all running local containers with
1357 their state. If one or more
1358 <replaceable>PATTERN</replaceable>s are specified, only
1359 containers matching one of them are shown.
1360 </para>
1361 </listitem>
1362 </varlistentry>
1363 </variablelist>
1364 </refsect2>
1365
1366 <refsect2>
1367 <title>Job Commands</title>
1368
1369 <variablelist>
1370 <varlistentry>
1371 <term><command>list-jobs <optional><replaceable>PATTERN...</replaceable></optional></command></term>
1372
1373 <listitem>
1374 <para>List jobs that are in progress. If one or more
1375 <replaceable>PATTERN</replaceable>s are specified, only
1376 jobs for units matching one of them are shown.</para>
1377 </listitem>
1378 </varlistentry>
1379 <varlistentry>
1380 <term><command>cancel <replaceable>JOB</replaceable>...</command></term>
1381
1382 <listitem>
1383 <para>Cancel one or more jobs specified on the command line
1384 by their numeric job IDs. If no job ID is specified, cancel
1385 all pending jobs.</para>
1386 </listitem>
1387 </varlistentry>
1388 </variablelist>
1389 </refsect2>
1390
1391 <refsect2>
1392 <title>Environment Commands</title>
1393
1394 <variablelist>
1395 <varlistentry>
1396 <term><command>show-environment</command></term>
1397
1398 <listitem>
1399 <para>Dump the systemd manager environment block. The
1400 environment block will be dumped in straight-forward form
1401 suitable for sourcing into a shell script. This environment
1402 block will be passed to all processes the manager
1403 spawns.</para>
1404 </listitem>
1405 </varlistentry>
1406 <varlistentry>
1407 <term><command>set-environment <replaceable>VARIABLE=VALUE</replaceable>...</command></term>
1408
1409 <listitem>
1410 <para>Set one or more systemd manager environment variables,
1411 as specified on the command line.</para>
1412 </listitem>
1413 </varlistentry>
1414 <varlistentry>
1415 <term><command>unset-environment <replaceable>VARIABLE</replaceable>...</command></term>
1416
1417 <listitem>
1418 <para>Unset one or more systemd manager environment
1419 variables. If only a variable name is specified, it will be
1420 removed regardless of its value. If a variable and a value
1421 are specified, the variable is only removed if it has the
1422 specified value.</para>
1423 </listitem>
1424 </varlistentry>
1425 <varlistentry>
1426 <term>
1427 <command>import-environment</command>
1428 <optional><replaceable>VARIABLE...</replaceable></optional>
1429 </term>
1430
1431 <listitem>
1432 <para>Import all, one or more environment variables set on
1433 the client into the systemd manager environment block. If
1434 no arguments are passed, the entire environment block is
1435 imported. Otherwise, a list of one or more environment
1436 variable names should be passed, whose client-side values
1437 are then imported into the manager's environment
1438 block.</para>
1439 </listitem>
1440 </varlistentry>
1441 </variablelist>
1442 </refsect2>
1443
1444 <refsect2>
1445 <title>Manager Lifecycle Commands</title>
1446
1447 <variablelist>
1448 <varlistentry>
1449 <term><command>daemon-reload</command></term>
1450
1451 <listitem>
1452 <para>Reload the systemd manager configuration. This will
1453 rerun all generators (see
1454 <citerefentry><refentrytitle>systemd.generator</refentrytitle><manvolnum>7</manvolnum></citerefentry>),
1455 reload all unit files, and recreate the entire dependency
1456 tree. While the daemon is being reloaded, all sockets
1457 systemd listens on behalf of user configuration will stay
1458 accessible.</para>
1459
1460 <para>This command should not be confused with the
1461 <command>reload</command> command.</para>
1462 </listitem>
1463 </varlistentry>
1464 <varlistentry>
1465 <term><command>daemon-reexec</command></term>
1466
1467 <listitem>
1468 <para>Reexecute the systemd manager. This will serialize the
1469 manager state, reexecute the process and deserialize the
1470 state again. This command is of little use except for
1471 debugging and package upgrades. Sometimes, it might be
1472 helpful as a heavy-weight <command>daemon-reload</command>.
1473 While the daemon is being reexecuted, all sockets systemd listening
1474 on behalf of user configuration will stay accessible.
1475 </para>
1476 </listitem>
1477 </varlistentry>
1478 </variablelist>
1479 </refsect2>
1480
1481 <refsect2>
1482 <title>System Commands</title>
1483
1484 <variablelist>
1485 <varlistentry>
1486 <term><command>is-system-running</command></term>
1487
1488 <listitem>
1489 <para>Checks whether the system is operational. This
1490 returns success (exit code 0) when the system is fully up
1491 and running, specifically not in startup, shutdown or
1492 maintenance mode, and with no failed services. Failure is
1493 returned otherwise (exit code non-zero). In addition, the
1494 current state is printed in a short string to standard
1495 output, see the table below. Use <option>--quiet</option> to
1496 suppress this output.</para>
1497
1498 <table>
1499 <title><command>is-system-running</command> output</title>
1500 <tgroup cols='3'>
1501 <colspec colname='name'/>
1502 <colspec colname='description'/>
1503 <colspec colname='exit-code'/>
1504 <thead>
1505 <row>
1506 <entry>Name</entry>
1507 <entry>Description</entry>
1508 <entry>Exit Code</entry>
1509 </row>
1510 </thead>
1511 <tbody>
1512 <row>
1513 <entry><varname>initializing</varname></entry>
1514 <entry><para>Early bootup, before
1515 <filename>basic.target</filename> is reached
1516 or the <varname>maintenance</varname> state entered.
1517 </para></entry>
1518 <entry>&gt; 0</entry>
1519 </row>
1520 <row>
1521 <entry><varname>starting</varname></entry>
1522 <entry><para>Late bootup, before the job queue
1523 becomes idle for the first time, or one of the
1524 rescue targets are reached.</para></entry>
1525 <entry>&gt; 0</entry>
1526 </row>
1527 <row>
1528 <entry><varname>running</varname></entry>
1529 <entry><para>The system is fully
1530 operational.</para></entry>
1531 <entry>0</entry>
1532 </row>
1533 <row>
1534 <entry><varname>degraded</varname></entry>
1535 <entry><para>The system is operational but one or more
1536 units failed.</para></entry>
1537 <entry>&gt; 0</entry>
1538 </row>
1539 <row>
1540 <entry><varname>maintenance</varname></entry>
1541 <entry><para>The rescue or emergency target is
1542 active.</para></entry>
1543 <entry>&gt; 0</entry>
1544 </row>
1545 <row>
1546 <entry><varname>stopping</varname></entry>
1547 <entry><para>The manager is shutting
1548 down.</para></entry>
1549 <entry>&gt; 0</entry>
1550 </row>
1551 <row>
1552 <entry><varname>offline</varname></entry>
1553 <entry><para>The manager is not
1554 running. Specifically, this is the operational
1555 state if an incompatible program is running as
1556 system manager (PID 1).</para></entry>
1557 <entry>&gt; 0</entry>
1558 </row>
1559 <row>
1560 <entry><varname>unknown</varname></entry>
1561 <entry><para>The operational state could not be
1562 determined, due to lack of resources or another
1563 error cause.</para></entry>
1564 <entry>&gt; 0</entry>
1565 </row>
1566 </tbody>
1567 </tgroup>
1568 </table>
1569 </listitem>
1570 </varlistentry>
1571
1572 <varlistentry>
1573 <term><command>default</command></term>
1574
1575 <listitem>
1576 <para>Enter default mode. This is mostly equivalent to
1577 <command>isolate default.target</command>.</para>
1578 </listitem>
1579 </varlistentry>
1580
1581 <varlistentry>
1582 <term><command>rescue</command></term>
1583
1584 <listitem>
1585 <para>Enter rescue mode. This is mostly equivalent to
1586 <command>isolate rescue.target</command>, but also prints a
1587 wall message to all users.</para>
1588 </listitem>
1589 </varlistentry>
1590 <varlistentry>
1591 <term><command>emergency</command></term>
1592
1593 <listitem>
1594 <para>Enter emergency mode. This is mostly equivalent to
1595 <command>isolate emergency.target</command>, but also prints
1596 a wall message to all users.</para>
1597 </listitem>
1598 </varlistentry>
1599 <varlistentry>
1600 <term><command>halt</command></term>
1601
1602 <listitem>
1603 <para>Shut down and halt the system. This is mostly equivalent to
1604 <command>start halt.target --job-mode=replace-irreversibly</command>, but also
1605 prints a wall message to all users. If combined with
1606 <option>--force</option>, shutdown of all running services is
1607 skipped, however all processes are killed and all file
1608 systems are unmounted or mounted read-only, immediately
1609 followed by the system halt. If <option>--force</option> is
1610 specified twice, the operation is immediately executed
1611 without terminating any processes or unmounting any file
1612 systems. This may result in data loss.</para>
1613 </listitem>
1614 </varlistentry>
1615 <varlistentry>
1616 <term><command>poweroff</command></term>
1617
1618 <listitem>
1619 <para>Shut down and power-off the system. This is mostly
1620 equivalent to <command>start poweroff.target --job-mode=replace-irreversibly</command>,
1621 but also prints a wall message to all users. If combined with
1622 <option>--force</option>, shutdown of all running services is
1623 skipped, however all processes are killed and all file
1624 systems are unmounted or mounted read-only, immediately
1625 followed by the powering off. If <option>--force</option> is
1626 specified twice, the operation is immediately executed
1627 without terminating any processes or unmounting any file
1628 systems. This may result in data loss.</para>
1629 </listitem>
1630 </varlistentry>
1631 <varlistentry>
1632 <term><command>reboot <optional><replaceable>arg</replaceable></optional></command></term>
1633
1634 <listitem>
1635 <para>Shut down and reboot the system. This is mostly
1636 equivalent to <command>start reboot.target --job-mode=replace-irreversibly</command>,
1637 but also prints a wall message to all users. If combined with
1638 <option>--force</option>, shutdown of all running services is
1639 skipped, however all processes are killed and all file
1640 systems are unmounted or mounted read-only, immediately
1641 followed by the reboot. If <option>--force</option> is
1642 specified twice, the operation is immediately executed
1643 without terminating any processes or unmounting any file
1644 systems. This may result in data loss.</para>
1645
1646 <para>If the optional argument
1647 <replaceable>arg</replaceable> is given, it will be passed
1648 as the optional argument to the
1649 <citerefentry><refentrytitle>reboot</refentrytitle><manvolnum>2</manvolnum></citerefentry>
1650 system call. The value is architecture and firmware
1651 specific. As an example, <literal>recovery</literal> might
1652 be used to trigger system recovery, and
1653 <literal>fota</literal> might be used to trigger a
1654 <quote>firmware over the air</quote> update.</para>
1655 </listitem>
1656 </varlistentry>
1657
1658 <varlistentry>
1659 <term><command>kexec</command></term>
1660
1661 <listitem>
1662 <para>Shut down and reboot the system via kexec. This is
1663 mostly equivalent to <command>start kexec.target --job-mode=replace-irreversibly</command>,
1664 but also prints a wall message to all users. If combined
1665 with <option>--force</option>, shutdown of all running
1666 services is skipped, however all processes are killed and
1667 all file systems are unmounted or mounted read-only,
1668 immediately followed by the reboot.</para>
1669 </listitem>
1670 </varlistentry>
1671
1672 <varlistentry>
1673 <term><command>exit <optional><replaceable>EXIT_CODE</replaceable></optional></command></term>
1674
1675 <listitem>
1676 <para>Ask the systemd manager to quit. This is only
1677 supported for user service managers (i.e. in conjunction
1678 with the <option>--user</option> option) or in containers
1679 and is equivalent to <command>poweroff</command> otherwise.</para>
1680
1681 <para>The systemd manager can exit with a non-zero exit
1682 code if the optional argument
1683 <replaceable>EXIT_CODE</replaceable> is given.</para>
1684 </listitem>
1685 </varlistentry>
1686
1687 <varlistentry>
1688 <term><command>switch-root <replaceable>ROOT</replaceable> <optional><replaceable>INIT</replaceable></optional></command></term>
1689
1690 <listitem>
1691 <para>Switches to a different root directory and executes a
1692 new system manager process below it. This is intended for
1693 usage in initial RAM disks ("initrd"), and will transition
1694 from the initrd's system manager process (a.k.a. "init"
1695 process) to the main system manager process. This call takes two
1696 arguments: the directory that is to become the new root directory, and
1697 the path to the new system manager binary below it to
1698 execute as PID 1. If the latter is omitted or the empty
1699 string, a systemd binary will automatically be searched for
1700 and used as init. If the system manager path is omitted or
1701 equal to the empty string, the state of the initrd's system
1702 manager process is passed to the main system manager, which
1703 allows later introspection of the state of the services
1704 involved in the initrd boot.</para>
1705 </listitem>
1706 </varlistentry>
1707
1708 <varlistentry>
1709 <term><command>suspend</command></term>
1710
1711 <listitem>
1712 <para>Suspend the system. This will trigger activation of
1713 the special <filename>suspend.target</filename> target.
1714 </para>
1715 </listitem>
1716 </varlistentry>
1717
1718 <varlistentry>
1719 <term><command>hibernate</command></term>
1720
1721 <listitem>
1722 <para>Hibernate the system. This will trigger activation of
1723 the special <filename>hibernate.target</filename> target.
1724 </para>
1725 </listitem>
1726 </varlistentry>
1727
1728 <varlistentry>
1729 <term><command>hybrid-sleep</command></term>
1730
1731 <listitem>
1732 <para>Hibernate and suspend the system. This will trigger
1733 activation of the special
1734 <filename>hybrid-sleep.target</filename> target.</para>
1735 </listitem>
1736 </varlistentry>
1737 </variablelist>
1738 </refsect2>
1739
1740 <refsect2>
1741 <title>Parameter Syntax</title>
1742
1743 <para>Unit commands listed above take either a single unit name (designated as <replaceable>NAME</replaceable>),
1744 or multiple unit specifications (designated as <replaceable>PATTERN</replaceable>...). In the first case, the
1745 unit name with or without a suffix must be given. If the suffix is not specified (unit name is "abbreviated"),
1746 systemctl will append a suitable suffix, <literal>.service</literal> by default, and a type-specific suffix in
1747 case of commands which operate only on specific unit types. For example,
1748 <programlisting># systemctl start sshd</programlisting> and
1749 <programlisting># systemctl start sshd.service</programlisting>
1750 are equivalent, as are
1751 <programlisting># systemctl isolate default</programlisting>
1752 and
1753 <programlisting># systemctl isolate default.target</programlisting>
1754 Note that (absolute) paths to device nodes are automatically converted to device unit names, and other (absolute)
1755 paths to mount unit names.
1756 <programlisting># systemctl status /dev/sda
1757 # systemctl status /home</programlisting>
1758 are equivalent to:
1759 <programlisting># systemctl status dev-sda.device
1760 # systemctl status home.mount</programlisting>
1761 In the second case, shell-style globs will be matched against the primary names of all currently loaded units;
1762 literal unit names, with or without a suffix, will be treated as in the first case. This means that literal unit
1763 names always refer to exactly one unit, but globs may match zero units and this is not considered an
1764 error.</para>
1765
1766 <para>Glob patterns use
1767 <citerefentry project='man-pages'><refentrytitle>fnmatch</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
1768 so normal shell-style globbing rules are used, and
1769 <literal>*</literal>, <literal>?</literal>,
1770 <literal>[]</literal> may be used. See
1771 <citerefentry project='man-pages'><refentrytitle>glob</refentrytitle><manvolnum>7</manvolnum></citerefentry>
1772 for more details. The patterns are matched against the primary names of
1773 currently loaded units, and patterns which do not match anything
1774 are silently skipped. For example:
1775 <programlisting># systemctl stop sshd@*.service</programlisting>
1776 will stop all <filename>sshd@.service</filename> instances. Note that alias names of units, and units that aren't
1777 loaded are not considered for glob expansion.
1778 </para>
1779
1780 <para>For unit file commands, the specified <replaceable>NAME</replaceable> should be the name of the unit file
1781 (possibly abbreviated, see above), or the absolute path to the unit file:
1782 <programlisting># systemctl enable foo.service</programlisting>
1783 or
1784 <programlisting># systemctl link /path/to/foo.service</programlisting>
1785 </para>
1786 </refsect2>
1787
1788 </refsect1>
1789
1790 <refsect1>
1791 <title>Exit status</title>
1792
1793 <para>On success, 0 is returned, a non-zero failure
1794 code otherwise.</para>
1795 </refsect1>
1796
1797 <refsect1>
1798 <title>Environment</title>
1799
1800 <variablelist class='environment-variables'>
1801 <varlistentry>
1802 <term><varname>$SYSTEMD_EDITOR</varname></term>
1803
1804 <listitem><para>Editor to use when editing units; overrides
1805 <varname>$EDITOR</varname> and <varname>$VISUAL</varname>. If neither
1806 <varname>$SYSTEMD_EDITOR</varname> nor <varname>$EDITOR</varname> nor
1807 <varname>$VISUAL</varname> are present or if it is set to an empty
1808 string or if their execution failed, systemctl will try to execute well
1809 known editors in this order:
1810 <citerefentry project='die-net'><refentrytitle>editor</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1811 <citerefentry project='die-net'><refentrytitle>nano</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1812 <citerefentry project='die-net'><refentrytitle>vim</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1813 <citerefentry project='die-net'><refentrytitle>vi</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
1814 </para></listitem>
1815 </varlistentry>
1816 </variablelist>
1817 <xi:include href="less-variables.xml" xpointer="pager"/>
1818 <xi:include href="less-variables.xml" xpointer="less"/>
1819 </refsect1>
1820
1821 <refsect1>
1822 <title>See Also</title>
1823 <para>
1824 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1825 <citerefentry><refentrytitle>journalctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1826 <citerefentry><refentrytitle>loginctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1827 <citerefentry><refentrytitle>machinectl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1828 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1829 <citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1830 <citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
1831 <citerefentry project='man-pages'><refentrytitle>wall</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1832 <citerefentry><refentrytitle>systemd.preset</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1833 <citerefentry><refentrytitle>systemd.generator</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
1834 <citerefentry project='man-pages'><refentrytitle>glob</refentrytitle><manvolnum>7</manvolnum></citerefentry>
1835 </para>
1836 </refsect1>
1837
1838 </refentry>