]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/systemctl.xml
Merge pull request #3392 from poettering/assorted-stuff
[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 with <command>list-units</command>, also show inactive units and
154 units which are following other units. When showing unit/job/manager properties, show all
155 properties regardless whether they are set or not.</para>
156
157 <para>To list all units installed in the file 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>, <command>poweroff</command>, <command>reboot</command> or
485 <command>kexec</command>, execute the selected operation without shutting down all units. However, all
486 processes will be killed forcibly and all file systems are unmounted or remounted read-only. This is hence a
487 drastic but relatively safe option to request an immediate reboot. If <option>--force</option> is specified
488 twice for these operations (with the exception of <command>kexec</command>), they will be executed
489 immediately, without terminating any processes or unmounting any file systems. Warning: specifying
490 <option>--force</option> twice with any of these operations might result in data loss. Note that when
491 <option>--force</option> is specified twice the selected operation is executed by
492 <command>systemctl</command> itself, and the system manager is not contacted. This means the command should
493 succeed even when the system manager hangs or crashed.</para>
494 </listitem>
495 </varlistentry>
496
497 <varlistentry>
498 <term><option>--message=</option></term>
499
500 <listitem>
501 <para>When used with <command>halt</command>,
502 <command>poweroff</command>, <command>reboot</command> or
503 <command>kexec</command>, set a short message explaining the reason
504 for the operation. The message will be logged together with the
505 default shutdown message.</para>
506 </listitem>
507 </varlistentry>
508
509 <varlistentry>
510 <term><option>--now</option></term>
511
512 <listitem>
513 <para>When used with <command>enable</command>, the units
514 will also be started. When used with <command>disable</command> or
515 <command>mask</command>, the units will also be stopped. The start
516 or stop operation is only carried out when the respective enable or
517 disable operation has been successful.</para>
518 </listitem>
519 </varlistentry>
520
521 <varlistentry>
522 <term><option>--root=</option></term>
523
524 <listitem>
525 <para>When used with
526 <command>enable</command>/<command>disable</command>/<command>is-enabled</command>
527 (and related commands), use an alternate root path when
528 looking for unit files.</para>
529 </listitem>
530
531 </varlistentry>
532
533 <varlistentry>
534 <term><option>--runtime</option></term>
535
536 <listitem>
537 <para>When used with <command>enable</command>,
538 <command>disable</command>, <command>edit</command>,
539 (and related commands), make changes only temporarily, so
540 that they are lost on the next reboot. This will have the
541 effect that changes are not made in subdirectories of
542 <filename>/etc</filename> but in <filename>/run</filename>,
543 with identical immediate effects, however, since the latter
544 is lost on reboot, the changes are lost too.</para>
545
546 <para>Similarly, when used with
547 <command>set-property</command>, make changes only
548 temporarily, so that they are lost on the next
549 reboot.</para>
550 </listitem>
551 </varlistentry>
552
553 <varlistentry>
554 <term><option>--preset-mode=</option></term>
555
556 <listitem>
557 <para>Takes one of <literal>full</literal> (the default),
558 <literal>enable-only</literal>,
559 <literal>disable-only</literal>. When used with the
560 <command>preset</command> or <command>preset-all</command>
561 commands, controls whether units shall be disabled and
562 enabled according to the preset rules, or only enabled, or
563 only disabled.</para>
564 </listitem>
565 </varlistentry>
566
567 <varlistentry>
568 <term><option>-n</option></term>
569 <term><option>--lines=</option></term>
570
571 <listitem>
572 <para>When used with <command>status</command>, controls the
573 number of journal lines to show, counting from the most
574 recent ones. Takes a positive integer argument. Defaults to
575 10.</para>
576 </listitem>
577 </varlistentry>
578
579 <varlistentry>
580 <term><option>-o</option></term>
581 <term><option>--output=</option></term>
582
583 <listitem>
584 <para>When used with <command>status</command>, controls the
585 formatting of the journal entries that are shown. For the
586 available choices, see
587 <citerefentry><refentrytitle>journalctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
588 Defaults to <literal>short</literal>.</para>
589 </listitem>
590 </varlistentry>
591
592 <varlistentry>
593 <term><option>--firmware-setup</option></term>
594
595 <listitem>
596 <para>When used with the <command>reboot</command> command,
597 indicate to the system's firmware to boot into setup
598 mode. Note that this is currently only supported on some EFI
599 systems and only if the system was booted in EFI
600 mode.</para>
601 </listitem>
602 </varlistentry>
603
604 <varlistentry>
605 <term><option>--plain</option></term>
606
607 <listitem>
608 <para>When used with <command>list-dependencies</command>,
609 <command>list-units</command> or <command>list-machines</command>, the
610 the output is printed as a list instead of a tree, and the bullet
611 circles are omitted.</para>
612 </listitem>
613 </varlistentry>
614
615 <xi:include href="user-system-options.xml" xpointer="host" />
616 <xi:include href="user-system-options.xml" xpointer="machine" />
617
618 <xi:include href="standard-options.xml" xpointer="no-pager" />
619 <xi:include href="standard-options.xml" xpointer="no-legend" />
620 <xi:include href="standard-options.xml" xpointer="help" />
621 <xi:include href="standard-options.xml" xpointer="version" />
622 </variablelist>
623 </refsect1>
624
625 <refsect1>
626 <title>Commands</title>
627
628 <para>The following commands are understood:</para>
629
630 <refsect2>
631 <title>Unit Commands</title>
632
633 <variablelist>
634 <varlistentry>
635 <term><command>list-units <optional><replaceable>PATTERN</replaceable>...</optional></command></term>
636
637 <listitem>
638 <para>List units that <command>systemd</command> has loaded. This includes units that
639 are either referenced directly or through a dependency, or units that were active in the
640 past and have failed. By default only units which are active, have pending jobs, or have
641 failed are shown; this can be changed with option <option>--all</option>. If one or more
642 <replaceable>PATTERN</replaceable>s are specified, only units matching one of them are
643 shown. The units that are shown are additionally filtered by <option>--type=</option>
644 and <option>--state=</option> if those options are specified.</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 unit files installed in the file system and their enablement state
974 (as reported by <command>is-enabled</command>). If one or more
975 <replaceable>PATTERN</replaceable>s are specified, only units whose filename
976 (just the last component of the path) matches one of them are shown.</para>
977 </listitem>
978 </varlistentry>
979
980 <varlistentry>
981 <term><command>enable <replaceable>NAME</replaceable>...</command></term>
982
983 <listitem>
984 <para>Enable one or more unit files or unit file instances,
985 as specified on the command line. This will create a number
986 of symlinks as encoded in the <literal>[Install]</literal>
987 sections of the unit files. After the symlinks have been
988 created, the systemd configuration is reloaded (in a way that
989 is equivalent to <command>daemon-reload</command>) to ensure
990 the changes are taken into account immediately. Note that
991 this does <emphasis>not</emphasis> have the effect of also
992 starting any of the units being enabled. If this
993 is desired, either <option>--now</option> should be used
994 together with this command, or an additional <command>start</command>
995 command must be invoked for the unit. Also note that, in case of
996 instance enablement, symlinks named the same as instances
997 are created in the install location, however they all point to the
998 same template unit file.</para>
999
1000 <para>This command will print the actions executed. This
1001 output may be suppressed by passing <option>--quiet</option>.
1002 </para>
1003
1004 <para>Note that this operation creates only the suggested
1005 symlinks for the units. While this command is the
1006 recommended way to manipulate the unit configuration
1007 directory, the administrator is free to make additional
1008 changes manually by placing or removing symlinks in the
1009 directory. This is particularly useful to create
1010 configurations that deviate from the suggested default
1011 installation. In this case, the administrator must make sure
1012 to invoke <command>daemon-reload</command> manually as
1013 necessary to ensure the changes are taken into account.
1014 </para>
1015
1016 <para>Enabling units should not be confused with starting
1017 (activating) units, as done by the <command>start</command>
1018 command. Enabling and starting units is orthogonal: units
1019 may be enabled without being started and started without
1020 being enabled. Enabling simply hooks the unit into various
1021 suggested places (for example, so that the unit is
1022 automatically started on boot or when a particular kind of
1023 hardware is plugged in). Starting actually spawns the daemon
1024 process (in case of service units), or binds the socket (in
1025 case of socket units), and so on.</para>
1026
1027 <para>Depending on whether <option>--system</option>,
1028 <option>--user</option>, <option>--runtime</option>,
1029 or <option>--global</option> is specified, this enables the unit
1030 for the system, for the calling user only, for only this boot of
1031 the system, or for all future logins of all users, or only this
1032 boot. Note that in the last case, no systemd daemon
1033 configuration is reloaded.</para>
1034
1035 <para>Using <command>enable</command> on masked units
1036 results in an error.</para>
1037 </listitem>
1038 </varlistentry>
1039
1040 <varlistentry>
1041 <term><command>disable <replaceable>NAME</replaceable>...</command></term>
1042
1043 <listitem>
1044 <para>Disables one or more units. This removes all symlinks
1045 to the specified unit files from the unit configuration
1046 directory, and hence undoes the changes made by
1047 <command>enable</command>. Note however that this removes
1048 all symlinks to the unit files (i.e. including manual
1049 additions), not just those actually created by
1050 <command>enable</command>. This call implicitly reloads the
1051 systemd daemon configuration after completing the disabling
1052 of the units. Note that this command does not implicitly
1053 stop the units that are being disabled. If this is desired, either
1054 <option>--now</option> should be used together with this command, or
1055 an additional <command>stop</command> command should be executed
1056 afterwards.</para>
1057
1058 <para>This command will print the actions executed. This
1059 output may be suppressed by passing <option>--quiet</option>.
1060 </para>
1061
1062 <para>This command honors <option>--system</option>,
1063 <option>--user</option>, <option>--runtime</option> and
1064 <option>--global</option> in a similar way as
1065 <command>enable</command>.</para>
1066 </listitem>
1067 </varlistentry>
1068
1069 <varlistentry>
1070 <term><command>reenable <replaceable>NAME</replaceable>...</command></term>
1071
1072 <listitem>
1073 <para>Reenable one or more unit files, as specified on the
1074 command line. This is a combination of
1075 <command>disable</command> and <command>enable</command> and
1076 is useful to reset the symlinks a unit is enabled with to
1077 the defaults configured in the <literal>[Install]</literal>
1078 section of the unit file.</para>
1079 </listitem>
1080 </varlistentry>
1081
1082 <varlistentry>
1083 <term><command>preset <replaceable>NAME</replaceable>...</command></term>
1084
1085 <listitem>
1086 <para>Reset the enable/disable status one or more unit files, as specified on
1087 the command line, to the defaults configured in the preset policy files. This
1088 has the same effect as <command>disable</command> or
1089 <command>enable</command>, depending how the unit is listed in the preset
1090 files.</para>
1091
1092 <para>Use <option>--preset-mode=</option> to control whether units shall be
1093 enabled and disabled, or only enabled, or only disabled.</para>
1094
1095 <para>If the unit carries no install information, it will be silently ignored
1096 by this command.</para>
1097
1098 <para>For more information on the preset policy format, see
1099 <citerefentry><refentrytitle>systemd.preset</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
1100 For more information on the concept of presets, please consult the
1101 <ulink url="http://freedesktop.org/wiki/Software/systemd/Preset">Preset</ulink>
1102 document.</para>
1103 </listitem>
1104 </varlistentry>
1105
1106 <varlistentry>
1107 <term><command>preset-all</command></term>
1108
1109 <listitem>
1110 <para>Resets all installed unit files to the defaults
1111 configured in the preset policy file (see above).</para>
1112
1113 <para>Use <option>--preset-mode=</option> to control
1114 whether units shall be enabled and disabled, or only
1115 enabled, or only disabled.</para>
1116 </listitem>
1117 </varlistentry>
1118
1119 <varlistentry>
1120 <term><command>is-enabled <replaceable>NAME</replaceable>...</command></term>
1121
1122 <listitem>
1123 <para>Checks whether any of the specified unit files are
1124 enabled (as with <command>enable</command>). Returns an
1125 exit code of 0 if at least one is enabled, non-zero
1126 otherwise. Prints the current enable status (see table).
1127 To suppress this output, use <option>--quiet</option>.
1128 </para>
1129
1130 <table>
1131 <title>
1132 <command>is-enabled</command> output
1133 </title>
1134
1135 <tgroup cols='3'>
1136 <thead>
1137 <row>
1138 <entry>Name</entry>
1139 <entry>Description</entry>
1140 <entry>Exit Code</entry>
1141 </row>
1142 </thead>
1143 <tbody>
1144 <row>
1145 <entry><literal>enabled</literal></entry>
1146 <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>
1147 <entry morerows='1'>0</entry>
1148 </row>
1149 <row>
1150 <entry><literal>enabled-runtime</literal></entry>
1151 </row>
1152 <row>
1153 <entry><literal>linked</literal></entry>
1154 <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>
1155 <entry morerows='1'>&gt; 0</entry>
1156 </row>
1157 <row>
1158 <entry><literal>linked-runtime</literal></entry>
1159 </row>
1160 <row>
1161 <entry><literal>masked</literal></entry>
1162 <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>
1163 <entry morerows='1'>&gt; 0</entry>
1164 </row>
1165 <row>
1166 <entry><literal>masked-runtime</literal></entry>
1167 </row>
1168 <row>
1169 <entry><literal>static</literal></entry>
1170 <entry>The unit file is not enabled, and has no provisions for enabling in the <literal>[Install]</literal> unit file section.</entry>
1171 <entry>0</entry>
1172 </row>
1173 <row>
1174 <entry><literal>indirect</literal></entry>
1175 <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>
1176 <entry>0</entry>
1177 </row>
1178 <row>
1179 <entry><literal>disabled</literal></entry>
1180 <entry>The unit file is not enabled, but contains an <literal>[Install]</literal> section with installation instructions.</entry>
1181 <entry>&gt; 0</entry>
1182 </row>
1183 <row>
1184 <entry><literal>generated</literal></entry>
1185 <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>
1186 <entry>0</entry>
1187 </row>
1188 <row>
1189 <entry><literal>transient</literal></entry>
1190 <entry>The unit file has been created dynamically with the runtime API. Transient units may not be enabled.</entry>
1191 <entry>0</entry>
1192 </row>
1193 <row>
1194 <entry><literal>bad</literal></entry>
1195 <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>
1196 <entry>&gt; 0</entry>
1197 </row>
1198 </tbody>
1199 </tgroup>
1200 </table>
1201
1202 </listitem>
1203 </varlistentry>
1204
1205 <varlistentry>
1206 <term><command>mask <replaceable>NAME</replaceable>...</command></term>
1207
1208 <listitem>
1209 <para>Mask one or more unit files, as specified on the
1210 command line. This will link these units to
1211 <filename>/dev/null</filename>, making it impossible to
1212 start them. This is a stronger version of
1213 <command>disable</command>, since it prohibits all kinds of
1214 activation of the unit, including enablement and manual
1215 activation. Use this option with care. This honors the
1216 <option>--runtime</option> option to only mask temporarily
1217 until the next reboot of the system. The <option>--now</option>
1218 option can be used to ensure that the units are also stopped.</para>
1219 </listitem>
1220 </varlistentry>
1221
1222 <varlistentry>
1223 <term><command>unmask <replaceable>NAME</replaceable>...</command></term>
1224
1225 <listitem>
1226 <para>Unmask one or more unit files, as specified on the
1227 command line. This will undo the effect of
1228 <command>mask</command>.</para>
1229 </listitem>
1230 </varlistentry>
1231
1232 <varlistentry>
1233 <term><command>link <replaceable>FILENAME</replaceable>...</command></term>
1234
1235 <listitem>
1236 <para>Link a unit file that is not in the unit file search
1237 paths into the unit file search path. This requires an
1238 absolute path to a unit file. The effect of this can be
1239 undone with <command>disable</command>. The effect of this
1240 command is that a unit file is available for
1241 <command>start</command> and other commands although it
1242 is not installed directly in the unit search path.</para>
1243 </listitem>
1244 </varlistentry>
1245
1246 <varlistentry>
1247 <term><command>revert <replaceable>NAME</replaceable>...</command></term>
1248
1249 <listitem>
1250 <para>Revert one or more unit files to their vendor versions. This command removes drop-in configuration
1251 files that modify the specified units, as well as any user-configured unit file that overrides a matching
1252 vendor supplied unit file. Specifically, for a unit <literal>foo.service</literal> the matching directories
1253 <literal>foo.service.d/</literal> with all their contained files are removed, both below the persistent and
1254 runtime configuration directories (i.e. below <filename>/etc/systemd/system</filename> and
1255 <filename>/run/systemd/system</filename>); if the unit file has a vendor-supplied version (i.e. a unit file
1256 located below <filename>/usr</filename>) any matching peristent or runtime unit file that overrides it is
1257 removed, too. Note that if a unit file has no vendor-supplied version (i.e. is only defined below
1258 <filename>/etc/systemd/system</filename> or <filename>/run/systemd/system</filename>, but not in a unit
1259 file stored below <filename>/usr</filename>), then it is not removed. Also, if a unit is masked, it is
1260 unmasked.</para>
1261
1262 <para>Effectively, this command may be used to undo all changes made with <command>systemctl
1263 edit</command>, <command>systemctl set-property</command> and <command>systemctl mask</command> and puts
1264 the original unit file with its settings back in effect.</para>
1265 </listitem>
1266 </varlistentry>
1267
1268 <varlistentry>
1269 <term><command>add-wants <replaceable>TARGET</replaceable>
1270 <replaceable>NAME</replaceable>...</command></term>
1271 <term><command>add-requires <replaceable>TARGET</replaceable>
1272 <replaceable>NAME</replaceable>...</command></term>
1273
1274 <listitem>
1275 <para>Adds <literal>Wants=</literal> or <literal>Requires=</literal>
1276 dependencies, respectively, to the specified
1277 <replaceable>TARGET</replaceable> for one or more units. </para>
1278
1279 <para>This command honors <option>--system</option>,
1280 <option>--user</option>, <option>--runtime</option> and
1281 <option>--global</option> in a way similar to
1282 <command>enable</command>.</para>
1283
1284 </listitem>
1285 </varlistentry>
1286
1287 <varlistentry>
1288 <term><command>edit <replaceable>NAME</replaceable>...</command></term>
1289
1290 <listitem>
1291 <para>Edit a drop-in snippet or a whole replacement file if
1292 <option>--full</option> is specified, to extend or override the
1293 specified unit.</para>
1294
1295 <para>Depending on whether <option>--system</option> (the default),
1296 <option>--user</option>, or <option>--global</option> is specified,
1297 this command creates a drop-in file for each unit either for the system,
1298 for the calling user, or for all futures logins of all users. Then,
1299 the editor (see the "Environment" section below) is invoked on
1300 temporary files which will be written to the real location if the
1301 editor exits successfully.</para>
1302
1303 <para>If <option>--full</option> is specified, this will copy the
1304 original units instead of creating drop-in files.</para>
1305
1306 <para>If <option>--runtime</option> is specified, the changes will
1307 be made temporarily in <filename>/run</filename> and they will be
1308 lost on the next reboot.</para>
1309
1310 <para>If the temporary file is empty upon exit, the modification of
1311 the related unit is canceled.</para>
1312
1313 <para>After the units have been edited, systemd configuration is
1314 reloaded (in a way that is equivalent to <command>daemon-reload</command>).
1315 </para>
1316
1317 <para>Note that this command cannot be used to remotely edit units
1318 and that you cannot temporarily edit units which are in
1319 <filename>/etc</filename>, since they take precedence over
1320 <filename>/run</filename>.</para>
1321 </listitem>
1322 </varlistentry>
1323
1324 <varlistentry>
1325 <term><command>get-default</command></term>
1326
1327 <listitem>
1328 <para>Return the default target to boot into. This returns
1329 the target unit name <filename>default.target</filename>
1330 is aliased (symlinked) to.</para>
1331 </listitem>
1332 </varlistentry>
1333
1334 <varlistentry>
1335 <term><command>set-default <replaceable>NAME</replaceable></command></term>
1336
1337 <listitem>
1338 <para>Set the default target to boot into. This sets
1339 (symlinks) the <filename>default.target</filename> alias
1340 to the given target unit.</para>
1341 </listitem>
1342 </varlistentry>
1343
1344 </variablelist>
1345 </refsect2>
1346
1347 <refsect2>
1348 <title>Machine Commands</title>
1349
1350 <variablelist>
1351 <varlistentry>
1352 <term><command>list-machines <optional><replaceable>PATTERN</replaceable>...</optional></command></term>
1353
1354 <listitem>
1355 <para>List the host and all running local containers with
1356 their state. If one or more
1357 <replaceable>PATTERN</replaceable>s are specified, only
1358 containers matching one of them are shown.
1359 </para>
1360 </listitem>
1361 </varlistentry>
1362 </variablelist>
1363 </refsect2>
1364
1365 <refsect2>
1366 <title>Job Commands</title>
1367
1368 <variablelist>
1369 <varlistentry>
1370 <term><command>list-jobs <optional><replaceable>PATTERN...</replaceable></optional></command></term>
1371
1372 <listitem>
1373 <para>List jobs that are in progress. If one or more
1374 <replaceable>PATTERN</replaceable>s are specified, only
1375 jobs for units matching one of them are shown.</para>
1376 </listitem>
1377 </varlistentry>
1378 <varlistentry>
1379 <term><command>cancel <replaceable>JOB</replaceable>...</command></term>
1380
1381 <listitem>
1382 <para>Cancel one or more jobs specified on the command line
1383 by their numeric job IDs. If no job ID is specified, cancel
1384 all pending jobs.</para>
1385 </listitem>
1386 </varlistentry>
1387 </variablelist>
1388 </refsect2>
1389
1390 <refsect2>
1391 <title>Environment Commands</title>
1392
1393 <variablelist>
1394 <varlistentry>
1395 <term><command>show-environment</command></term>
1396
1397 <listitem>
1398 <para>Dump the systemd manager environment block. The
1399 environment block will be dumped in straight-forward form
1400 suitable for sourcing into a shell script. This environment
1401 block will be passed to all processes the manager
1402 spawns.</para>
1403 </listitem>
1404 </varlistentry>
1405 <varlistentry>
1406 <term><command>set-environment <replaceable>VARIABLE=VALUE</replaceable>...</command></term>
1407
1408 <listitem>
1409 <para>Set one or more systemd manager environment variables,
1410 as specified on the command line.</para>
1411 </listitem>
1412 </varlistentry>
1413 <varlistentry>
1414 <term><command>unset-environment <replaceable>VARIABLE</replaceable>...</command></term>
1415
1416 <listitem>
1417 <para>Unset one or more systemd manager environment
1418 variables. If only a variable name is specified, it will be
1419 removed regardless of its value. If a variable and a value
1420 are specified, the variable is only removed if it has the
1421 specified value.</para>
1422 </listitem>
1423 </varlistentry>
1424 <varlistentry>
1425 <term>
1426 <command>import-environment</command>
1427 <optional><replaceable>VARIABLE...</replaceable></optional>
1428 </term>
1429
1430 <listitem>
1431 <para>Import all, one or more environment variables set on
1432 the client into the systemd manager environment block. If
1433 no arguments are passed, the entire environment block is
1434 imported. Otherwise, a list of one or more environment
1435 variable names should be passed, whose client-side values
1436 are then imported into the manager's environment
1437 block.</para>
1438 </listitem>
1439 </varlistentry>
1440 </variablelist>
1441 </refsect2>
1442
1443 <refsect2>
1444 <title>Manager Lifecycle Commands</title>
1445
1446 <variablelist>
1447 <varlistentry>
1448 <term><command>daemon-reload</command></term>
1449
1450 <listitem>
1451 <para>Reload the systemd manager configuration. This will
1452 rerun all generators (see
1453 <citerefentry><refentrytitle>systemd.generator</refentrytitle><manvolnum>7</manvolnum></citerefentry>),
1454 reload all unit files, and recreate the entire dependency
1455 tree. While the daemon is being reloaded, all sockets
1456 systemd listens on behalf of user configuration will stay
1457 accessible.</para>
1458
1459 <para>This command should not be confused with the
1460 <command>reload</command> command.</para>
1461 </listitem>
1462 </varlistentry>
1463 <varlistentry>
1464 <term><command>daemon-reexec</command></term>
1465
1466 <listitem>
1467 <para>Reexecute the systemd manager. This will serialize the
1468 manager state, reexecute the process and deserialize the
1469 state again. This command is of little use except for
1470 debugging and package upgrades. Sometimes, it might be
1471 helpful as a heavy-weight <command>daemon-reload</command>.
1472 While the daemon is being reexecuted, all sockets systemd listening
1473 on behalf of user configuration will stay accessible.
1474 </para>
1475 </listitem>
1476 </varlistentry>
1477 </variablelist>
1478 </refsect2>
1479
1480 <refsect2>
1481 <title>System Commands</title>
1482
1483 <variablelist>
1484 <varlistentry>
1485 <term><command>is-system-running</command></term>
1486
1487 <listitem>
1488 <para>Checks whether the system is operational. This
1489 returns success (exit code 0) when the system is fully up
1490 and running, specifically not in startup, shutdown or
1491 maintenance mode, and with no failed services. Failure is
1492 returned otherwise (exit code non-zero). In addition, the
1493 current state is printed in a short string to standard
1494 output, see the table below. Use <option>--quiet</option> to
1495 suppress this output.</para>
1496
1497 <table>
1498 <title><command>is-system-running</command> output</title>
1499 <tgroup cols='3'>
1500 <colspec colname='name'/>
1501 <colspec colname='description'/>
1502 <colspec colname='exit-code'/>
1503 <thead>
1504 <row>
1505 <entry>Name</entry>
1506 <entry>Description</entry>
1507 <entry>Exit Code</entry>
1508 </row>
1509 </thead>
1510 <tbody>
1511 <row>
1512 <entry><varname>initializing</varname></entry>
1513 <entry><para>Early bootup, before
1514 <filename>basic.target</filename> is reached
1515 or the <varname>maintenance</varname> state entered.
1516 </para></entry>
1517 <entry>&gt; 0</entry>
1518 </row>
1519 <row>
1520 <entry><varname>starting</varname></entry>
1521 <entry><para>Late bootup, before the job queue
1522 becomes idle for the first time, or one of the
1523 rescue targets are reached.</para></entry>
1524 <entry>&gt; 0</entry>
1525 </row>
1526 <row>
1527 <entry><varname>running</varname></entry>
1528 <entry><para>The system is fully
1529 operational.</para></entry>
1530 <entry>0</entry>
1531 </row>
1532 <row>
1533 <entry><varname>degraded</varname></entry>
1534 <entry><para>The system is operational but one or more
1535 units failed.</para></entry>
1536 <entry>&gt; 0</entry>
1537 </row>
1538 <row>
1539 <entry><varname>maintenance</varname></entry>
1540 <entry><para>The rescue or emergency target is
1541 active.</para></entry>
1542 <entry>&gt; 0</entry>
1543 </row>
1544 <row>
1545 <entry><varname>stopping</varname></entry>
1546 <entry><para>The manager is shutting
1547 down.</para></entry>
1548 <entry>&gt; 0</entry>
1549 </row>
1550 <row>
1551 <entry><varname>offline</varname></entry>
1552 <entry><para>The manager is not
1553 running. Specifically, this is the operational
1554 state if an incompatible program is running as
1555 system manager (PID 1).</para></entry>
1556 <entry>&gt; 0</entry>
1557 </row>
1558 <row>
1559 <entry><varname>unknown</varname></entry>
1560 <entry><para>The operational state could not be
1561 determined, due to lack of resources or another
1562 error cause.</para></entry>
1563 <entry>&gt; 0</entry>
1564 </row>
1565 </tbody>
1566 </tgroup>
1567 </table>
1568 </listitem>
1569 </varlistentry>
1570
1571 <varlistentry>
1572 <term><command>default</command></term>
1573
1574 <listitem>
1575 <para>Enter default mode. This is mostly equivalent to
1576 <command>isolate default.target</command>.</para>
1577 </listitem>
1578 </varlistentry>
1579
1580 <varlistentry>
1581 <term><command>rescue</command></term>
1582
1583 <listitem>
1584 <para>Enter rescue mode. This is mostly equivalent to
1585 <command>isolate rescue.target</command>, but also prints a
1586 wall message to all users.</para>
1587 </listitem>
1588 </varlistentry>
1589 <varlistentry>
1590 <term><command>emergency</command></term>
1591
1592 <listitem>
1593 <para>Enter emergency mode. This is mostly equivalent to
1594 <command>isolate emergency.target</command>, but also prints
1595 a wall message to all users.</para>
1596 </listitem>
1597 </varlistentry>
1598 <varlistentry>
1599 <term><command>halt</command></term>
1600
1601 <listitem>
1602 <para>Shut down and halt the system. This is mostly equivalent to <command>start halt.target
1603 --job-mode=replace-irreversibly</command>, but also prints a wall message to all users. If combined with
1604 <option>--force</option>, shutdown of all running services is skipped, however all processes are killed and
1605 all file systems are unmounted or mounted read-only, immediately followed by the system halt. If
1606 <option>--force</option> is specified twice, the operation is immediately executed without terminating any
1607 processes or unmounting any file systems. This may result in data loss. Note that when
1608 <option>--force</option> is specified twice the halt operation is executed by
1609 <command>systemctl</command> itself, and the system manager is not contacted. This means the command should
1610 succeed even when the system manager hangs or crashed.</para>
1611 </listitem>
1612 </varlistentry>
1613 <varlistentry>
1614 <term><command>poweroff</command></term>
1615
1616 <listitem>
1617 <para>Shut down and power-off the system. This is mostly equivalent to <command>start poweroff.target
1618 --job-mode=replace-irreversibly</command>, but also prints a wall message to all users. If combined with
1619 <option>--force</option>, shutdown of all running services is skipped, however all processes are killed and
1620 all file systems are unmounted or mounted read-only, immediately followed by the powering off. If
1621 <option>--force</option> is specified twice, the operation is immediately executed without terminating any
1622 processes or unmounting any file systems. This may result in data loss. Note that when
1623 <option>--force</option> is specified twice the power-off operation is executed by
1624 <command>systemctl</command> itself, and the system manager is not contacted. This means the command should
1625 succeed even when the system manager hangs or crashed.</para>
1626 </listitem>
1627 </varlistentry>
1628 <varlistentry>
1629 <term><command>reboot <optional><replaceable>arg</replaceable></optional></command></term>
1630
1631 <listitem>
1632 <para>Shut down and reboot the system. This is mostly equivalent to <command>start reboot.target
1633 --job-mode=replace-irreversibly</command>, but also prints a wall message to all users. If combined with
1634 <option>--force</option>, shutdown of all running services is skipped, however all processes are killed and
1635 all file systems are unmounted or mounted read-only, immediately followed by the reboot. If
1636 <option>--force</option> is specified twice, the operation is immediately executed without terminating any
1637 processes or unmounting any file systems. This may result in data loss. Note that when
1638 <option>--force</option> is specified twice the reboot operation is executed by
1639 <command>systemctl</command> itself, and the system manager is not contacted. This means the command should
1640 succeed even when the system manager hangs or crashed.</para>
1641
1642 <para>If the optional argument
1643 <replaceable>arg</replaceable> is given, it will be passed
1644 as the optional argument to the
1645 <citerefentry><refentrytitle>reboot</refentrytitle><manvolnum>2</manvolnum></citerefentry>
1646 system call. The value is architecture and firmware
1647 specific. As an example, <literal>recovery</literal> might
1648 be used to trigger system recovery, and
1649 <literal>fota</literal> might be used to trigger a
1650 <quote>firmware over the air</quote> update.</para>
1651 </listitem>
1652 </varlistentry>
1653
1654 <varlistentry>
1655 <term><command>kexec</command></term>
1656
1657 <listitem>
1658 <para>Shut down and reboot the system via kexec. This is
1659 mostly equivalent to <command>start kexec.target --job-mode=replace-irreversibly</command>,
1660 but also prints a wall message to all users. If combined
1661 with <option>--force</option>, shutdown of all running
1662 services is skipped, however all processes are killed and
1663 all file systems are unmounted or mounted read-only,
1664 immediately followed by the reboot.</para>
1665 </listitem>
1666 </varlistentry>
1667
1668 <varlistentry>
1669 <term><command>exit <optional><replaceable>EXIT_CODE</replaceable></optional></command></term>
1670
1671 <listitem>
1672 <para>Ask the systemd manager to quit. This is only
1673 supported for user service managers (i.e. in conjunction
1674 with the <option>--user</option> option) or in containers
1675 and is equivalent to <command>poweroff</command> otherwise.</para>
1676
1677 <para>The systemd manager can exit with a non-zero exit
1678 code if the optional argument
1679 <replaceable>EXIT_CODE</replaceable> is given.</para>
1680 </listitem>
1681 </varlistentry>
1682
1683 <varlistentry>
1684 <term><command>switch-root <replaceable>ROOT</replaceable> <optional><replaceable>INIT</replaceable></optional></command></term>
1685
1686 <listitem>
1687 <para>Switches to a different root directory and executes a
1688 new system manager process below it. This is intended for
1689 usage in initial RAM disks ("initrd"), and will transition
1690 from the initrd's system manager process (a.k.a. "init"
1691 process) to the main system manager process. This call takes two
1692 arguments: the directory that is to become the new root directory, and
1693 the path to the new system manager binary below it to
1694 execute as PID 1. If the latter is omitted or the empty
1695 string, a systemd binary will automatically be searched for
1696 and used as init. If the system manager path is omitted or
1697 equal to the empty string, the state of the initrd's system
1698 manager process is passed to the main system manager, which
1699 allows later introspection of the state of the services
1700 involved in the initrd boot.</para>
1701 </listitem>
1702 </varlistentry>
1703
1704 <varlistentry>
1705 <term><command>suspend</command></term>
1706
1707 <listitem>
1708 <para>Suspend the system. This will trigger activation of
1709 the special <filename>suspend.target</filename> target.
1710 </para>
1711 </listitem>
1712 </varlistentry>
1713
1714 <varlistentry>
1715 <term><command>hibernate</command></term>
1716
1717 <listitem>
1718 <para>Hibernate the system. This will trigger activation of
1719 the special <filename>hibernate.target</filename> target.
1720 </para>
1721 </listitem>
1722 </varlistentry>
1723
1724 <varlistentry>
1725 <term><command>hybrid-sleep</command></term>
1726
1727 <listitem>
1728 <para>Hibernate and suspend the system. This will trigger
1729 activation of the special
1730 <filename>hybrid-sleep.target</filename> target.</para>
1731 </listitem>
1732 </varlistentry>
1733 </variablelist>
1734 </refsect2>
1735
1736 <refsect2>
1737 <title>Parameter Syntax</title>
1738
1739 <para>Unit commands listed above take either a single unit name (designated as <replaceable>NAME</replaceable>),
1740 or multiple unit specifications (designated as <replaceable>PATTERN</replaceable>...). In the first case, the
1741 unit name with or without a suffix must be given. If the suffix is not specified (unit name is "abbreviated"),
1742 systemctl will append a suitable suffix, <literal>.service</literal> by default, and a type-specific suffix in
1743 case of commands which operate only on specific unit types. For example,
1744 <programlisting># systemctl start sshd</programlisting> and
1745 <programlisting># systemctl start sshd.service</programlisting>
1746 are equivalent, as are
1747 <programlisting># systemctl isolate default</programlisting>
1748 and
1749 <programlisting># systemctl isolate default.target</programlisting>
1750 Note that (absolute) paths to device nodes are automatically converted to device unit names, and other (absolute)
1751 paths to mount unit names.
1752 <programlisting># systemctl status /dev/sda
1753 # systemctl status /home</programlisting>
1754 are equivalent to:
1755 <programlisting># systemctl status dev-sda.device
1756 # systemctl status home.mount</programlisting>
1757 In the second case, shell-style globs will be matched against the primary names of all currently loaded units;
1758 literal unit names, with or without a suffix, will be treated as in the first case. This means that literal unit
1759 names always refer to exactly one unit, but globs may match zero units and this is not considered an
1760 error.</para>
1761
1762 <para>Glob patterns use
1763 <citerefentry project='man-pages'><refentrytitle>fnmatch</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
1764 so normal shell-style globbing rules are used, and
1765 <literal>*</literal>, <literal>?</literal>,
1766 <literal>[]</literal> may be used. See
1767 <citerefentry project='man-pages'><refentrytitle>glob</refentrytitle><manvolnum>7</manvolnum></citerefentry>
1768 for more details. The patterns are matched against the primary names of
1769 currently loaded units, and patterns which do not match anything
1770 are silently skipped. For example:
1771 <programlisting># systemctl stop sshd@*.service</programlisting>
1772 will stop all <filename>sshd@.service</filename> instances. Note that alias names of units, and units that aren't
1773 loaded are not considered for glob expansion.
1774 </para>
1775
1776 <para>For unit file commands, the specified <replaceable>NAME</replaceable> should be the name of the unit file
1777 (possibly abbreviated, see above), or the absolute path to the unit file:
1778 <programlisting># systemctl enable foo.service</programlisting>
1779 or
1780 <programlisting># systemctl link /path/to/foo.service</programlisting>
1781 </para>
1782 </refsect2>
1783
1784 </refsect1>
1785
1786 <refsect1>
1787 <title>Exit status</title>
1788
1789 <para>On success, 0 is returned, a non-zero failure
1790 code otherwise.</para>
1791 </refsect1>
1792
1793 <refsect1>
1794 <title>Environment</title>
1795
1796 <variablelist class='environment-variables'>
1797 <varlistentry>
1798 <term><varname>$SYSTEMD_EDITOR</varname></term>
1799
1800 <listitem><para>Editor to use when editing units; overrides
1801 <varname>$EDITOR</varname> and <varname>$VISUAL</varname>. If neither
1802 <varname>$SYSTEMD_EDITOR</varname> nor <varname>$EDITOR</varname> nor
1803 <varname>$VISUAL</varname> are present or if it is set to an empty
1804 string or if their execution failed, systemctl will try to execute well
1805 known editors in this order:
1806 <citerefentry project='die-net'><refentrytitle>editor</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1807 <citerefentry project='die-net'><refentrytitle>nano</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1808 <citerefentry project='die-net'><refentrytitle>vim</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1809 <citerefentry project='die-net'><refentrytitle>vi</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
1810 </para></listitem>
1811 </varlistentry>
1812 </variablelist>
1813 <xi:include href="less-variables.xml" xpointer="pager"/>
1814 <xi:include href="less-variables.xml" xpointer="less"/>
1815 </refsect1>
1816
1817 <refsect1>
1818 <title>See Also</title>
1819 <para>
1820 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1821 <citerefentry><refentrytitle>journalctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1822 <citerefentry><refentrytitle>loginctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1823 <citerefentry><refentrytitle>machinectl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1824 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1825 <citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1826 <citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
1827 <citerefentry project='man-pages'><refentrytitle>wall</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1828 <citerefentry><refentrytitle>systemd.preset</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1829 <citerefentry><refentrytitle>systemd.generator</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
1830 <citerefentry project='man-pages'><refentrytitle>glob</refentrytitle><manvolnum>7</manvolnum></citerefentry>
1831 </para>
1832 </refsect1>
1833
1834 </refentry>