]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/systemctl.xml
man: replace dash with mdash where appropriate
[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>edit</command>, create all of the
485 specified units which do not already exist.</para>
486
487 <para>When used with <command>halt</command>, <command>poweroff</command>, <command>reboot</command> or
488 <command>kexec</command>, execute the selected operation without shutting down all units. However, all
489 processes will be killed forcibly and all file systems are unmounted or remounted read-only. This is hence a
490 drastic but relatively safe option to request an immediate reboot. If <option>--force</option> is specified
491 twice for these operations (with the exception of <command>kexec</command>), they will be executed
492 immediately, without terminating any processes or unmounting any file systems. Warning: specifying
493 <option>--force</option> twice with any of these operations might result in data loss. Note that when
494 <option>--force</option> is specified twice the selected operation is executed by
495 <command>systemctl</command> itself, and the system manager is not contacted. This means the command should
496 succeed even when the system manager hangs or crashed.</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 units that <command>systemd</command> has loaded. This includes units that
642 are either referenced directly or through a dependency, or units that were active in the
643 past and have failed. By default only units which are active, have pending jobs, or have
644 failed are shown; this can be changed with option <option>--all</option>. If one or more
645 <replaceable>PATTERN</replaceable>s are specified, only units matching one of them are
646 shown. The units that are shown are additionally filtered by <option>--type=</option>
647 and <option>--state=</option> if those options are specified.</para>
648
649 <para>This is the default command.</para>
650 </listitem>
651 </varlistentry>
652
653 <varlistentry>
654 <term><command>list-sockets <optional><replaceable>PATTERN</replaceable>...</optional></command></term>
655
656 <listitem>
657 <para>List socket units ordered by listening address.
658 If one or more <replaceable>PATTERN</replaceable>s are
659 specified, only socket units matching one of them are
660 shown. Produces output similar to
661 <programlisting>
662 LISTEN UNIT ACTIVATES
663 /dev/initctl systemd-initctl.socket systemd-initctl.service
664 ...
665 [::]:22 sshd.socket sshd.service
666 kobject-uevent 1 systemd-udevd-kernel.socket systemd-udevd.service
667
668 5 sockets listed.</programlisting>
669 Note: because the addresses might contains spaces, this output
670 is not suitable for programmatic consumption.
671 </para>
672
673 <para>See also the options <option>--show-types</option>,
674 <option>--all</option>, and <option>--state=</option>.</para>
675 </listitem>
676 </varlistentry>
677
678 <varlistentry>
679 <term><command>list-timers <optional><replaceable>PATTERN</replaceable>...</optional></command></term>
680
681 <listitem>
682 <para>List timer units ordered by the time they elapse
683 next. If one or more <replaceable>PATTERN</replaceable>s
684 are specified, only units matching one of them are shown.
685 </para>
686
687 <para>See also the options <option>--all</option> and
688 <option>--state=</option>.</para>
689 </listitem>
690 </varlistentry>
691
692 <varlistentry>
693 <term><command>start <replaceable>PATTERN</replaceable>...</command></term>
694
695 <listitem>
696 <para>Start (activate) one or more units specified on the
697 command line.</para>
698
699 <para>Note that glob patterns operate on the set of primary names of currently loaded units. Units which
700 are not active and are not in a failed state usually are not loaded, and will not be matched by any
701 pattern. In addition, in case of instantiated units, systemd is often unaware of the instance name until
702 the instance has been started. Therefore, using glob patterns with <command>start</command> has limited
703 usefulness. Also, secondary alias names of units are not considered.</para>
704 </listitem>
705 </varlistentry>
706 <varlistentry>
707 <term><command>stop <replaceable>PATTERN</replaceable>...</command></term>
708
709 <listitem>
710 <para>Stop (deactivate) one or more units specified on the
711 command line.</para>
712 </listitem>
713 </varlistentry>
714 <varlistentry>
715 <term><command>reload <replaceable>PATTERN</replaceable>...</command></term>
716
717 <listitem>
718 <para>Asks all units listed on the command line to reload
719 their configuration. Note that this will reload the
720 service-specific configuration, not the unit configuration
721 file of systemd. If you want systemd to reload the
722 configuration file of a unit, use the
723 <command>daemon-reload</command> command. In other words:
724 for the example case of Apache, this will reload Apache's
725 <filename>httpd.conf</filename> in the web server, not the
726 <filename>apache.service</filename> systemd unit
727 file.</para>
728
729 <para>This command should not be confused with the
730 <command>daemon-reload</command> command.</para>
731 </listitem>
732
733 </varlistentry>
734 <varlistentry>
735 <term><command>restart <replaceable>PATTERN</replaceable>...</command></term>
736
737 <listitem>
738 <para>Restart one or more units specified on the command
739 line. If the units are not running yet, they will be
740 started.</para>
741 </listitem>
742 </varlistentry>
743 <varlistentry>
744 <term><command>try-restart <replaceable>PATTERN</replaceable>...</command></term>
745
746 <listitem>
747 <para>Restart one or more units specified on the command
748 line if the units are running. This does nothing if units are not
749 running.</para>
750 <!-- Note that we don't document condrestart here, as that is just compatibility support, and we generally
751 don't document that. -->
752 </listitem>
753 </varlistentry>
754 <varlistentry>
755 <term><command>reload-or-restart <replaceable>PATTERN</replaceable>...</command></term>
756
757 <listitem>
758 <para>Reload one or more units if they support it. If not,
759 restart them instead. If the units are not running yet, they
760 will be started.</para>
761 </listitem>
762 </varlistentry>
763 <varlistentry>
764 <term><command>try-reload-or-restart <replaceable>PATTERN</replaceable>...</command></term>
765
766 <listitem>
767 <para>Reload one or more units if they support it. If not,
768 restart them instead. This does nothing if the units are not
769 running.</para>
770 <!-- Note that we don't document force-reload here, as that is just compatibility support, and we generally
771 don't document that. -->
772 </listitem>
773 </varlistentry>
774 <varlistentry>
775 <term><command>isolate <replaceable>NAME</replaceable></command></term>
776
777 <listitem>
778 <para>Start the unit specified on the command line and its
779 dependencies and stop all others. If a unit name with no
780 extension is given, an extension of
781 <literal>.target</literal> will be assumed.</para>
782
783 <para>This is similar to changing the runlevel in a
784 traditional init system. The <command>isolate</command>
785 command will immediately stop processes that are not enabled
786 in the new unit, possibly including the graphical
787 environment or terminal you are currently using.</para>
788
789 <para>Note that this is allowed only on units where
790 <option>AllowIsolate=</option> is enabled. See
791 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
792 for details.</para>
793 </listitem>
794 </varlistentry>
795 <varlistentry>
796 <term><command>kill <replaceable>PATTERN</replaceable>...</command></term>
797
798 <listitem>
799 <para>Send a signal to one or more processes of the
800 unit. Use <option>--kill-who=</option> to select which
801 process to kill. Use <option>--signal=</option> to select
802 the signal to send.</para>
803 </listitem>
804 </varlistentry>
805 <varlistentry>
806 <term><command>is-active <replaceable>PATTERN</replaceable>...</command></term>
807
808 <listitem>
809 <para>Check whether any of the specified units are active
810 (i.e. running). Returns an exit code
811 <constant>0</constant> if at least one is active, or
812 non-zero otherwise. Unless <option>--quiet</option> is
813 specified, this will also print the current unit state to
814 standard output.</para>
815 </listitem>
816 </varlistentry>
817 <varlistentry>
818 <term><command>is-failed <replaceable>PATTERN</replaceable>...</command></term>
819
820 <listitem>
821 <para>Check whether any of the specified units are in a
822 "failed" state. Returns an exit code
823 <constant>0</constant> if at least one has failed,
824 non-zero otherwise. Unless <option>--quiet</option> is
825 specified, this will also print the current unit state to
826 standard output.</para>
827 </listitem>
828 </varlistentry>
829 <varlistentry>
830 <term><command>status</command> <optional><replaceable>PATTERN</replaceable>...|<replaceable>PID</replaceable>...]</optional></term>
831
832 <listitem>
833 <para>Show terse runtime status information about one or
834 more units, followed by most recent log data from the
835 journal. If no units are specified, show system status. If
836 combined with <option>--all</option>, also show the status of
837 all units (subject to limitations specified with
838 <option>-t</option>). If a PID is passed, show information
839 about the unit the process belongs to.</para>
840
841 <para>This function is intended to generate human-readable
842 output. If you are looking for computer-parsable output,
843 use <command>show</command> instead. By default, this
844 function only shows 10 lines of output and ellipsizes
845 lines to fit in the terminal window. This can be changed
846 with <option>--lines</option> and <option>--full</option>,
847 see above. In addition, <command>journalctl
848 --unit=<replaceable>NAME</replaceable></command> or
849 <command>journalctl
850 --user-unit=<replaceable>NAME</replaceable></command> use
851 a similar filter for messages and might be more
852 convenient.
853 </para>
854 </listitem>
855 </varlistentry>
856 <varlistentry>
857 <term><command>show</command> <optional><replaceable>PATTERN</replaceable>...|<replaceable>JOB</replaceable>...</optional></term>
858
859 <listitem>
860 <para>Show properties of one or more units, jobs, or the
861 manager itself. If no argument is specified, properties of
862 the manager will be shown. If a unit name is specified,
863 properties of the unit is shown, and if a job ID is
864 specified, properties of the job is shown. By default, empty
865 properties are suppressed. Use <option>--all</option> to
866 show those too. To select specific properties to show, use
867 <option>--property=</option>. This command is intended to be
868 used whenever computer-parsable output is required. Use
869 <command>status</command> if you are looking for formatted
870 human-readable output.</para>
871 </listitem>
872 </varlistentry>
873 <varlistentry>
874 <term><command>cat <replaceable>PATTERN</replaceable>...</command></term>
875
876 <listitem>
877 <para>Show backing files of one or more units. Prints the
878 "fragment" and "drop-ins" (source files) of units. Each
879 file is preceded by a comment which includes the file
880 name.</para>
881 </listitem>
882 </varlistentry>
883 <varlistentry>
884 <term><command>set-property <replaceable>NAME</replaceable> <replaceable>ASSIGNMENT</replaceable>...</command></term>
885
886 <listitem>
887 <para>Set the specified unit properties at runtime where
888 this is supported. This allows changing configuration
889 parameter properties such as resource control settings at
890 runtime. Not all properties may be changed at runtime, but
891 many resource control settings (primarily those in
892 <citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>)
893 may. The changes are applied instantly, and stored on disk
894 for future boots, unless <option>--runtime</option> is
895 passed, in which case the settings only apply until the
896 next reboot. The syntax of the property assignment follows
897 closely the syntax of assignments in unit files.</para>
898
899 <para>Example: <command>systemctl set-property foobar.service CPUShares=777</command></para>
900
901 <para>If the specified unit appears to be inactive, the
902 changes will be only stored on disk as described
903 previously hence they will be effective when the unit will
904 be started.</para>
905
906 <para>Note that this command allows changing multiple
907 properties at the same time, which is preferable over
908 setting them individually. Like unit file configuration
909 settings, assigning the empty list to list parameters will
910 reset the list.</para>
911 </listitem>
912 </varlistentry>
913
914 <varlistentry>
915 <term><command>help <replaceable>PATTERN</replaceable>...|<replaceable>PID</replaceable>...</command></term>
916
917 <listitem>
918 <para>Show manual pages for one or more units, if
919 available. If a PID is given, the manual pages for the unit
920 the process belongs to are shown.</para>
921 </listitem>
922 </varlistentry>
923
924 <varlistentry>
925 <term><command>reset-failed [<replaceable>PATTERN</replaceable>...]</command></term>
926
927 <listitem>
928 <para>Reset the <literal>failed</literal> state of the
929 specified units, or if no unit name is passed, reset the state of all
930 units. When a unit fails in some way (i.e. process exiting
931 with non-zero error code, terminating abnormally or timing
932 out), it will automatically enter the
933 <literal>failed</literal> state and its exit code and status
934 is recorded for introspection by the administrator until the
935 service is restarted or reset with this command.</para>
936 </listitem>
937 </varlistentry>
938
939 <varlistentry>
940 <term>
941 <command>list-dependencies</command>
942 <optional><replaceable>NAME</replaceable></optional>
943 </term>
944
945 <listitem>
946 <para>Shows units required and wanted by the specified
947 unit. This recursively lists units following the
948 <varname>Requires=</varname>,
949 <varname>Requisite=</varname>,
950 <varname>ConsistsOf=</varname>,
951 <varname>Wants=</varname>, <varname>BindsTo=</varname>
952 dependencies. If no unit is specified,
953 <filename>default.target</filename> is implied.</para>
954
955 <para>By default, only target units are recursively
956 expanded. When <option>--all</option> is passed, all other
957 units are recursively expanded as well.</para>
958
959 <para>Options <option>--reverse</option>,
960 <option>--after</option>, <option>--before</option>
961 may be used to change what types of dependencies
962 are shown.</para>
963 </listitem>
964 </varlistentry>
965 </variablelist>
966 </refsect2>
967
968 <refsect2>
969 <title>Unit File Commands</title>
970
971 <variablelist>
972 <varlistentry>
973 <term><command>list-unit-files <optional><replaceable>PATTERN...</replaceable></optional></command></term>
974
975 <listitem>
976 <para>List unit files installed in the file system and their enablement state
977 (as reported by <command>is-enabled</command>). If one or more
978 <replaceable>PATTERN</replaceable>s are specified, only units whose filename
979 (just the last component of the path) matches one of them are shown.</para>
980 </listitem>
981 </varlistentry>
982
983 <varlistentry>
984 <term><command>enable <replaceable>NAME</replaceable>...</command></term>
985
986 <listitem>
987 <para>Enable one or more unit files or unit file instances,
988 as specified on the command line. This will create a number
989 of symlinks as encoded in the <literal>[Install]</literal>
990 sections of the unit files. After the symlinks have been
991 created, the systemd configuration is reloaded (in a way that
992 is equivalent to <command>daemon-reload</command>) to ensure
993 the changes are taken into account immediately. Note that
994 this does <emphasis>not</emphasis> have the effect of also
995 starting any of the units being enabled. If this
996 is desired, either <option>--now</option> should be used
997 together with this command, or an additional <command>start</command>
998 command must be invoked for the unit. Also note that, in case of
999 instance enablement, symlinks named the same as instances
1000 are created in the install location, however they all point to the
1001 same template unit file.</para>
1002
1003 <para>This command will print the actions executed. This
1004 output may be suppressed by passing <option>--quiet</option>.
1005 </para>
1006
1007 <para>Note that this operation creates only the suggested
1008 symlinks for the units. While this command is the
1009 recommended way to manipulate the unit configuration
1010 directory, the administrator is free to make additional
1011 changes manually by placing or removing symlinks in the
1012 directory. This is particularly useful to create
1013 configurations that deviate from the suggested default
1014 installation. In this case, the administrator must make sure
1015 to invoke <command>daemon-reload</command> manually as
1016 necessary to ensure the changes are taken into account.
1017 </para>
1018
1019 <para>Enabling units should not be confused with starting
1020 (activating) units, as done by the <command>start</command>
1021 command. Enabling and starting units is orthogonal: units
1022 may be enabled without being started and started without
1023 being enabled. Enabling simply hooks the unit into various
1024 suggested places (for example, so that the unit is
1025 automatically started on boot or when a particular kind of
1026 hardware is plugged in). Starting actually spawns the daemon
1027 process (in case of service units), or binds the socket (in
1028 case of socket units), and so on.</para>
1029
1030 <para>Depending on whether <option>--system</option>,
1031 <option>--user</option>, <option>--runtime</option>,
1032 or <option>--global</option> is specified, this enables the unit
1033 for the system, for the calling user only, for only this boot of
1034 the system, or for all future logins of all users, or only this
1035 boot. Note that in the last case, no systemd daemon
1036 configuration is reloaded.</para>
1037
1038 <para>Using <command>enable</command> on masked units
1039 results in an error.</para>
1040 </listitem>
1041 </varlistentry>
1042
1043 <varlistentry>
1044 <term><command>disable <replaceable>NAME</replaceable>...</command></term>
1045
1046 <listitem>
1047 <para>Disables one or more units. This removes all symlinks
1048 to the specified unit files from the unit configuration
1049 directory, and hence undoes the changes made by
1050 <command>enable</command>. Note however that this removes
1051 all symlinks to the unit files (i.e. including manual
1052 additions), not just those actually created by
1053 <command>enable</command>. This call implicitly reloads the
1054 systemd daemon configuration after completing the disabling
1055 of the units. Note that this command does not implicitly
1056 stop the units that are being disabled. If this is desired, either
1057 <option>--now</option> should be used together with this command, or
1058 an additional <command>stop</command> command should be executed
1059 afterwards.</para>
1060
1061 <para>This command will print the actions executed. This
1062 output may be suppressed by passing <option>--quiet</option>.
1063 </para>
1064
1065 <para>This command honors <option>--system</option>,
1066 <option>--user</option>, <option>--runtime</option> and
1067 <option>--global</option> in a similar way as
1068 <command>enable</command>.</para>
1069 </listitem>
1070 </varlistentry>
1071
1072 <varlistentry>
1073 <term><command>reenable <replaceable>NAME</replaceable>...</command></term>
1074
1075 <listitem>
1076 <para>Reenable one or more unit files, as specified on the
1077 command line. This is a combination of
1078 <command>disable</command> and <command>enable</command> and
1079 is useful to reset the symlinks a unit is enabled with to
1080 the defaults configured in the <literal>[Install]</literal>
1081 section of the unit file.</para>
1082 </listitem>
1083 </varlistentry>
1084
1085 <varlistentry>
1086 <term><command>preset <replaceable>NAME</replaceable>...</command></term>
1087
1088 <listitem>
1089 <para>Reset the enable/disable status one or more unit files, as specified on
1090 the command line, to the defaults configured in the preset policy files. This
1091 has the same effect as <command>disable</command> or
1092 <command>enable</command>, depending how the unit is listed in the preset
1093 files.</para>
1094
1095 <para>Use <option>--preset-mode=</option> to control whether units shall be
1096 enabled and disabled, or only enabled, or only disabled.</para>
1097
1098 <para>If the unit carries no install information, it will be silently ignored
1099 by this command.</para>
1100
1101 <para>For more information on the preset policy format, see
1102 <citerefentry><refentrytitle>systemd.preset</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
1103 For more information on the concept of presets, please consult the
1104 <ulink url="http://freedesktop.org/wiki/Software/systemd/Preset">Preset</ulink>
1105 document.</para>
1106 </listitem>
1107 </varlistentry>
1108
1109 <varlistentry>
1110 <term><command>preset-all</command></term>
1111
1112 <listitem>
1113 <para>Resets all installed unit files to the defaults
1114 configured in the preset policy file (see above).</para>
1115
1116 <para>Use <option>--preset-mode=</option> to control
1117 whether units shall be enabled and disabled, or only
1118 enabled, or only disabled.</para>
1119 </listitem>
1120 </varlistentry>
1121
1122 <varlistentry>
1123 <term><command>is-enabled <replaceable>NAME</replaceable>...</command></term>
1124
1125 <listitem>
1126 <para>Checks whether any of the specified unit files are
1127 enabled (as with <command>enable</command>). Returns an
1128 exit code of 0 if at least one is enabled, non-zero
1129 otherwise. Prints the current enable status (see table).
1130 To suppress this output, use <option>--quiet</option>.
1131 </para>
1132
1133 <table>
1134 <title>
1135 <command>is-enabled</command> output
1136 </title>
1137
1138 <tgroup cols='3'>
1139 <thead>
1140 <row>
1141 <entry>Name</entry>
1142 <entry>Description</entry>
1143 <entry>Exit Code</entry>
1144 </row>
1145 </thead>
1146 <tbody>
1147 <row>
1148 <entry><literal>enabled</literal></entry>
1149 <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>
1150 <entry morerows='1'>0</entry>
1151 </row>
1152 <row>
1153 <entry><literal>enabled-runtime</literal></entry>
1154 </row>
1155 <row>
1156 <entry><literal>linked</literal></entry>
1157 <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>
1158 <entry morerows='1'>&gt; 0</entry>
1159 </row>
1160 <row>
1161 <entry><literal>linked-runtime</literal></entry>
1162 </row>
1163 <row>
1164 <entry><literal>masked</literal></entry>
1165 <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>
1166 <entry morerows='1'>&gt; 0</entry>
1167 </row>
1168 <row>
1169 <entry><literal>masked-runtime</literal></entry>
1170 </row>
1171 <row>
1172 <entry><literal>static</literal></entry>
1173 <entry>The unit file is not enabled, and has no provisions for enabling in the <literal>[Install]</literal> unit file section.</entry>
1174 <entry>0</entry>
1175 </row>
1176 <row>
1177 <entry><literal>indirect</literal></entry>
1178 <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>
1179 <entry>0</entry>
1180 </row>
1181 <row>
1182 <entry><literal>disabled</literal></entry>
1183 <entry>The unit file is not enabled, but contains an <literal>[Install]</literal> section with installation instructions.</entry>
1184 <entry>&gt; 0</entry>
1185 </row>
1186 <row>
1187 <entry><literal>generated</literal></entry>
1188 <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>
1189 <entry>0</entry>
1190 </row>
1191 <row>
1192 <entry><literal>transient</literal></entry>
1193 <entry>The unit file has been created dynamically with the runtime API. Transient units may not be enabled.</entry>
1194 <entry>0</entry>
1195 </row>
1196 <row>
1197 <entry><literal>bad</literal></entry>
1198 <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>
1199 <entry>&gt; 0</entry>
1200 </row>
1201 </tbody>
1202 </tgroup>
1203 </table>
1204
1205 </listitem>
1206 </varlistentry>
1207
1208 <varlistentry>
1209 <term><command>mask <replaceable>NAME</replaceable>...</command></term>
1210
1211 <listitem>
1212 <para>Mask one or more unit files, as specified on the
1213 command line. This will link these units to
1214 <filename>/dev/null</filename>, making it impossible to
1215 start them. This is a stronger version of
1216 <command>disable</command>, since it prohibits all kinds of
1217 activation of the unit, including enablement and manual
1218 activation. Use this option with care. This honors the
1219 <option>--runtime</option> option to only mask temporarily
1220 until the next reboot of the system. The <option>--now</option>
1221 option can be used to ensure that the units are also stopped.</para>
1222 </listitem>
1223 </varlistentry>
1224
1225 <varlistentry>
1226 <term><command>unmask <replaceable>NAME</replaceable>...</command></term>
1227
1228 <listitem>
1229 <para>Unmask one or more unit files, as specified on the
1230 command line. This will undo the effect of
1231 <command>mask</command>.</para>
1232 </listitem>
1233 </varlistentry>
1234
1235 <varlistentry>
1236 <term><command>link <replaceable>FILENAME</replaceable>...</command></term>
1237
1238 <listitem>
1239 <para>Link a unit file that is not in the unit file search
1240 paths into the unit file search path. This requires an
1241 absolute path to a unit file. The effect of this can be
1242 undone with <command>disable</command>. The effect of this
1243 command is that a unit file is available for
1244 <command>start</command> and other commands although it
1245 is not installed directly in the unit search path.</para>
1246 </listitem>
1247 </varlistentry>
1248
1249 <varlistentry>
1250 <term><command>revert <replaceable>NAME</replaceable>...</command></term>
1251
1252 <listitem>
1253 <para>Revert one or more unit files to their vendor versions. This command removes drop-in configuration
1254 files that modify the specified units, as well as any user-configured unit file that overrides a matching
1255 vendor supplied unit file. Specifically, for a unit <literal>foo.service</literal> the matching directories
1256 <literal>foo.service.d/</literal> with all their contained files are removed, both below the persistent and
1257 runtime configuration directories (i.e. below <filename>/etc/systemd/system</filename> and
1258 <filename>/run/systemd/system</filename>); if the unit file has a vendor-supplied version (i.e. a unit file
1259 located below <filename>/usr</filename>) any matching peristent or runtime unit file that overrides it is
1260 removed, too. Note that if a unit file has no vendor-supplied version (i.e. is only defined below
1261 <filename>/etc/systemd/system</filename> or <filename>/run/systemd/system</filename>, but not in a unit
1262 file stored below <filename>/usr</filename>), then it is not removed. Also, if a unit is masked, it is
1263 unmasked.</para>
1264
1265 <para>Effectively, this command may be used to undo all changes made with <command>systemctl
1266 edit</command>, <command>systemctl set-property</command> and <command>systemctl mask</command> and puts
1267 the original unit file with its settings back in effect.</para>
1268 </listitem>
1269 </varlistentry>
1270
1271 <varlistentry>
1272 <term><command>add-wants <replaceable>TARGET</replaceable>
1273 <replaceable>NAME</replaceable>...</command></term>
1274 <term><command>add-requires <replaceable>TARGET</replaceable>
1275 <replaceable>NAME</replaceable>...</command></term>
1276
1277 <listitem>
1278 <para>Adds <literal>Wants=</literal> or <literal>Requires=</literal>
1279 dependencies, respectively, to the specified
1280 <replaceable>TARGET</replaceable> for one or more units. </para>
1281
1282 <para>This command honors <option>--system</option>,
1283 <option>--user</option>, <option>--runtime</option> and
1284 <option>--global</option> in a way similar to
1285 <command>enable</command>.</para>
1286
1287 </listitem>
1288 </varlistentry>
1289
1290 <varlistentry>
1291 <term><command>edit <replaceable>NAME</replaceable>...</command></term>
1292
1293 <listitem>
1294 <para>Edit a drop-in snippet or a whole replacement file if
1295 <option>--full</option> is specified, to extend or override the
1296 specified unit.</para>
1297
1298 <para>Depending on whether <option>--system</option> (the default),
1299 <option>--user</option>, or <option>--global</option> is specified,
1300 this command creates a drop-in file for each unit either for the system,
1301 for the calling user, or for all futures logins of all users. Then,
1302 the editor (see the "Environment" section below) is invoked on
1303 temporary files which will be written to the real location if the
1304 editor exits successfully.</para>
1305
1306 <para>If <option>--full</option> is specified, this will copy the
1307 original units instead of creating drop-in files.</para>
1308
1309 <para>If <option>--force</option> is specified and any units do
1310 not already exist, new unit files will be opened for editing.</para>
1311
1312 <para>If <option>--runtime</option> is specified, the changes will
1313 be made temporarily in <filename>/run</filename> and they will be
1314 lost on the next reboot.</para>
1315
1316 <para>If the temporary file is empty upon exit, the modification of
1317 the related unit is canceled.</para>
1318
1319 <para>After the units have been edited, systemd configuration is
1320 reloaded (in a way that is equivalent to <command>daemon-reload</command>).
1321 </para>
1322
1323 <para>Note that this command cannot be used to remotely edit units
1324 and that you cannot temporarily edit units which are in
1325 <filename>/etc</filename>, since they take precedence over
1326 <filename>/run</filename>.</para>
1327 </listitem>
1328 </varlistentry>
1329
1330 <varlistentry>
1331 <term><command>get-default</command></term>
1332
1333 <listitem>
1334 <para>Return the default target to boot into. This returns
1335 the target unit name <filename>default.target</filename>
1336 is aliased (symlinked) to.</para>
1337 </listitem>
1338 </varlistentry>
1339
1340 <varlistentry>
1341 <term><command>set-default <replaceable>NAME</replaceable></command></term>
1342
1343 <listitem>
1344 <para>Set the default target to boot into. This sets
1345 (symlinks) the <filename>default.target</filename> alias
1346 to the given target unit.</para>
1347 </listitem>
1348 </varlistentry>
1349
1350 </variablelist>
1351 </refsect2>
1352
1353 <refsect2>
1354 <title>Machine Commands</title>
1355
1356 <variablelist>
1357 <varlistentry>
1358 <term><command>list-machines <optional><replaceable>PATTERN</replaceable>...</optional></command></term>
1359
1360 <listitem>
1361 <para>List the host and all running local containers with
1362 their state. If one or more
1363 <replaceable>PATTERN</replaceable>s are specified, only
1364 containers matching one of them are shown.
1365 </para>
1366 </listitem>
1367 </varlistentry>
1368 </variablelist>
1369 </refsect2>
1370
1371 <refsect2>
1372 <title>Job Commands</title>
1373
1374 <variablelist>
1375 <varlistentry>
1376 <term><command>list-jobs <optional><replaceable>PATTERN...</replaceable></optional></command></term>
1377
1378 <listitem>
1379 <para>List jobs that are in progress. If one or more
1380 <replaceable>PATTERN</replaceable>s are specified, only
1381 jobs for units matching one of them are shown.</para>
1382 </listitem>
1383 </varlistentry>
1384 <varlistentry>
1385 <term><command>cancel <replaceable>JOB</replaceable>...</command></term>
1386
1387 <listitem>
1388 <para>Cancel one or more jobs specified on the command line
1389 by their numeric job IDs. If no job ID is specified, cancel
1390 all pending jobs.</para>
1391 </listitem>
1392 </varlistentry>
1393 </variablelist>
1394 </refsect2>
1395
1396 <refsect2>
1397 <title>Environment Commands</title>
1398
1399 <variablelist>
1400 <varlistentry>
1401 <term><command>show-environment</command></term>
1402
1403 <listitem>
1404 <para>Dump the systemd manager environment block. The
1405 environment block will be dumped in straight-forward form
1406 suitable for sourcing into a shell script. This environment
1407 block will be passed to all processes the manager
1408 spawns.</para>
1409 </listitem>
1410 </varlistentry>
1411 <varlistentry>
1412 <term><command>set-environment <replaceable>VARIABLE=VALUE</replaceable>...</command></term>
1413
1414 <listitem>
1415 <para>Set one or more systemd manager environment variables,
1416 as specified on the command line.</para>
1417 </listitem>
1418 </varlistentry>
1419 <varlistentry>
1420 <term><command>unset-environment <replaceable>VARIABLE</replaceable>...</command></term>
1421
1422 <listitem>
1423 <para>Unset one or more systemd manager environment
1424 variables. If only a variable name is specified, it will be
1425 removed regardless of its value. If a variable and a value
1426 are specified, the variable is only removed if it has the
1427 specified value.</para>
1428 </listitem>
1429 </varlistentry>
1430 <varlistentry>
1431 <term>
1432 <command>import-environment</command>
1433 <optional><replaceable>VARIABLE...</replaceable></optional>
1434 </term>
1435
1436 <listitem>
1437 <para>Import all, one or more environment variables set on
1438 the client into the systemd manager environment block. If
1439 no arguments are passed, the entire environment block is
1440 imported. Otherwise, a list of one or more environment
1441 variable names should be passed, whose client-side values
1442 are then imported into the manager's environment
1443 block.</para>
1444 </listitem>
1445 </varlistentry>
1446 </variablelist>
1447 </refsect2>
1448
1449 <refsect2>
1450 <title>Manager Lifecycle Commands</title>
1451
1452 <variablelist>
1453 <varlistentry>
1454 <term><command>daemon-reload</command></term>
1455
1456 <listitem>
1457 <para>Reload the systemd manager configuration. This will
1458 rerun all generators (see
1459 <citerefentry><refentrytitle>systemd.generator</refentrytitle><manvolnum>7</manvolnum></citerefentry>),
1460 reload all unit files, and recreate the entire dependency
1461 tree. While the daemon is being reloaded, all sockets
1462 systemd listens on behalf of user configuration will stay
1463 accessible.</para>
1464
1465 <para>This command should not be confused with the
1466 <command>reload</command> command.</para>
1467 </listitem>
1468 </varlistentry>
1469 <varlistentry>
1470 <term><command>daemon-reexec</command></term>
1471
1472 <listitem>
1473 <para>Reexecute the systemd manager. This will serialize the
1474 manager state, reexecute the process and deserialize the
1475 state again. This command is of little use except for
1476 debugging and package upgrades. Sometimes, it might be
1477 helpful as a heavy-weight <command>daemon-reload</command>.
1478 While the daemon is being reexecuted, all sockets systemd listening
1479 on behalf of user configuration will stay accessible.
1480 </para>
1481 </listitem>
1482 </varlistentry>
1483 </variablelist>
1484 </refsect2>
1485
1486 <refsect2>
1487 <title>System Commands</title>
1488
1489 <variablelist>
1490 <varlistentry>
1491 <term><command>is-system-running</command></term>
1492
1493 <listitem>
1494 <para>Checks whether the system is operational. This
1495 returns success (exit code 0) when the system is fully up
1496 and running, specifically not in startup, shutdown or
1497 maintenance mode, and with no failed services. Failure is
1498 returned otherwise (exit code non-zero). In addition, the
1499 current state is printed in a short string to standard
1500 output, see the table below. Use <option>--quiet</option> to
1501 suppress this output.</para>
1502
1503 <table>
1504 <title><command>is-system-running</command> output</title>
1505 <tgroup cols='3'>
1506 <colspec colname='name'/>
1507 <colspec colname='description'/>
1508 <colspec colname='exit-code'/>
1509 <thead>
1510 <row>
1511 <entry>Name</entry>
1512 <entry>Description</entry>
1513 <entry>Exit Code</entry>
1514 </row>
1515 </thead>
1516 <tbody>
1517 <row>
1518 <entry><varname>initializing</varname></entry>
1519 <entry><para>Early bootup, before
1520 <filename>basic.target</filename> is reached
1521 or the <varname>maintenance</varname> state entered.
1522 </para></entry>
1523 <entry>&gt; 0</entry>
1524 </row>
1525 <row>
1526 <entry><varname>starting</varname></entry>
1527 <entry><para>Late bootup, before the job queue
1528 becomes idle for the first time, or one of the
1529 rescue targets are reached.</para></entry>
1530 <entry>&gt; 0</entry>
1531 </row>
1532 <row>
1533 <entry><varname>running</varname></entry>
1534 <entry><para>The system is fully
1535 operational.</para></entry>
1536 <entry>0</entry>
1537 </row>
1538 <row>
1539 <entry><varname>degraded</varname></entry>
1540 <entry><para>The system is operational but one or more
1541 units failed.</para></entry>
1542 <entry>&gt; 0</entry>
1543 </row>
1544 <row>
1545 <entry><varname>maintenance</varname></entry>
1546 <entry><para>The rescue or emergency target is
1547 active.</para></entry>
1548 <entry>&gt; 0</entry>
1549 </row>
1550 <row>
1551 <entry><varname>stopping</varname></entry>
1552 <entry><para>The manager is shutting
1553 down.</para></entry>
1554 <entry>&gt; 0</entry>
1555 </row>
1556 <row>
1557 <entry><varname>offline</varname></entry>
1558 <entry><para>The manager is not
1559 running. Specifically, this is the operational
1560 state if an incompatible program is running as
1561 system manager (PID 1).</para></entry>
1562 <entry>&gt; 0</entry>
1563 </row>
1564 <row>
1565 <entry><varname>unknown</varname></entry>
1566 <entry><para>The operational state could not be
1567 determined, due to lack of resources or another
1568 error cause.</para></entry>
1569 <entry>&gt; 0</entry>
1570 </row>
1571 </tbody>
1572 </tgroup>
1573 </table>
1574 </listitem>
1575 </varlistentry>
1576
1577 <varlistentry>
1578 <term><command>default</command></term>
1579
1580 <listitem>
1581 <para>Enter default mode. This is mostly equivalent to
1582 <command>isolate default.target</command>.</para>
1583 </listitem>
1584 </varlistentry>
1585
1586 <varlistentry>
1587 <term><command>rescue</command></term>
1588
1589 <listitem>
1590 <para>Enter rescue mode. This is mostly equivalent to
1591 <command>isolate rescue.target</command>, but also prints a
1592 wall message to all users.</para>
1593 </listitem>
1594 </varlistentry>
1595 <varlistentry>
1596 <term><command>emergency</command></term>
1597
1598 <listitem>
1599 <para>Enter emergency mode. This is mostly equivalent to
1600 <command>isolate emergency.target</command>, but also prints
1601 a wall message to all users.</para>
1602 </listitem>
1603 </varlistentry>
1604 <varlistentry>
1605 <term><command>halt</command></term>
1606
1607 <listitem>
1608 <para>Shut down and halt the system. This is mostly equivalent to <command>start halt.target
1609 --job-mode=replace-irreversibly</command>, but also prints a wall message to all users. If combined with
1610 <option>--force</option>, shutdown of all running services is skipped, however all processes are killed and
1611 all file systems are unmounted or mounted read-only, immediately followed by the system halt. If
1612 <option>--force</option> is specified twice, the operation is immediately executed without terminating any
1613 processes or unmounting any file systems. This may result in data loss. Note that when
1614 <option>--force</option> is specified twice the halt operation is executed by
1615 <command>systemctl</command> itself, and the system manager is not contacted. This means the command should
1616 succeed even when the system manager hangs or crashed.</para>
1617 </listitem>
1618 </varlistentry>
1619 <varlistentry>
1620 <term><command>poweroff</command></term>
1621
1622 <listitem>
1623 <para>Shut down and power-off the system. This is mostly equivalent to <command>start poweroff.target
1624 --job-mode=replace-irreversibly</command>, but also prints a wall message to all users. If combined with
1625 <option>--force</option>, shutdown of all running services is skipped, however all processes are killed and
1626 all file systems are unmounted or mounted read-only, immediately followed by the powering off. If
1627 <option>--force</option> is specified twice, the operation is immediately executed without terminating any
1628 processes or unmounting any file systems. This may result in data loss. Note that when
1629 <option>--force</option> is specified twice the power-off operation is executed by
1630 <command>systemctl</command> itself, and the system manager is not contacted. This means the command should
1631 succeed even when the system manager hangs or crashed.</para>
1632 </listitem>
1633 </varlistentry>
1634 <varlistentry>
1635 <term><command>reboot <optional><replaceable>arg</replaceable></optional></command></term>
1636
1637 <listitem>
1638 <para>Shut down and reboot the system. This is mostly equivalent to <command>start reboot.target
1639 --job-mode=replace-irreversibly</command>, but also prints a wall message to all users. If combined with
1640 <option>--force</option>, shutdown of all running services is skipped, however all processes are killed and
1641 all file systems are unmounted or mounted read-only, immediately followed by the reboot. If
1642 <option>--force</option> is specified twice, the operation is immediately executed without terminating any
1643 processes or unmounting any file systems. This may result in data loss. Note that when
1644 <option>--force</option> is specified twice the reboot operation is executed by
1645 <command>systemctl</command> itself, and the system manager is not contacted. This means the command should
1646 succeed even when the system manager hangs or crashed.</para>
1647
1648 <para>If the optional argument
1649 <replaceable>arg</replaceable> is given, it will be passed
1650 as the optional argument to the
1651 <citerefentry><refentrytitle>reboot</refentrytitle><manvolnum>2</manvolnum></citerefentry>
1652 system call. The value is architecture and firmware
1653 specific. As an example, <literal>recovery</literal> might
1654 be used to trigger system recovery, and
1655 <literal>fota</literal> might be used to trigger a
1656 <quote>firmware over the air</quote> update.</para>
1657 </listitem>
1658 </varlistentry>
1659
1660 <varlistentry>
1661 <term><command>kexec</command></term>
1662
1663 <listitem>
1664 <para>Shut down and reboot the system via kexec. This is
1665 mostly equivalent to <command>start kexec.target --job-mode=replace-irreversibly</command>,
1666 but also prints a wall message to all users. If combined
1667 with <option>--force</option>, shutdown of all running
1668 services is skipped, however all processes are killed and
1669 all file systems are unmounted or mounted read-only,
1670 immediately followed by the reboot.</para>
1671 </listitem>
1672 </varlistentry>
1673
1674 <varlistentry>
1675 <term><command>exit <optional><replaceable>EXIT_CODE</replaceable></optional></command></term>
1676
1677 <listitem>
1678 <para>Ask the systemd manager to quit. This is only
1679 supported for user service managers (i.e. in conjunction
1680 with the <option>--user</option> option) or in containers
1681 and is equivalent to <command>poweroff</command> otherwise.</para>
1682
1683 <para>The systemd manager can exit with a non-zero exit
1684 code if the optional argument
1685 <replaceable>EXIT_CODE</replaceable> is given.</para>
1686 </listitem>
1687 </varlistentry>
1688
1689 <varlistentry>
1690 <term><command>switch-root <replaceable>ROOT</replaceable> <optional><replaceable>INIT</replaceable></optional></command></term>
1691
1692 <listitem>
1693 <para>Switches to a different root directory and executes a
1694 new system manager process below it. This is intended for
1695 usage in initial RAM disks ("initrd"), and will transition
1696 from the initrd's system manager process (a.k.a. "init"
1697 process) to the main system manager process. This call takes two
1698 arguments: the directory that is to become the new root directory, and
1699 the path to the new system manager binary below it to
1700 execute as PID 1. If the latter is omitted or the empty
1701 string, a systemd binary will automatically be searched for
1702 and used as init. If the system manager path is omitted or
1703 equal to the empty string, the state of the initrd's system
1704 manager process is passed to the main system manager, which
1705 allows later introspection of the state of the services
1706 involved in the initrd boot.</para>
1707 </listitem>
1708 </varlistentry>
1709
1710 <varlistentry>
1711 <term><command>suspend</command></term>
1712
1713 <listitem>
1714 <para>Suspend the system. This will trigger activation of
1715 the special <filename>suspend.target</filename> target.
1716 </para>
1717 </listitem>
1718 </varlistentry>
1719
1720 <varlistentry>
1721 <term><command>hibernate</command></term>
1722
1723 <listitem>
1724 <para>Hibernate the system. This will trigger activation of
1725 the special <filename>hibernate.target</filename> target.
1726 </para>
1727 </listitem>
1728 </varlistentry>
1729
1730 <varlistentry>
1731 <term><command>hybrid-sleep</command></term>
1732
1733 <listitem>
1734 <para>Hibernate and suspend the system. This will trigger
1735 activation of the special
1736 <filename>hybrid-sleep.target</filename> target.</para>
1737 </listitem>
1738 </varlistentry>
1739 </variablelist>
1740 </refsect2>
1741
1742 <refsect2>
1743 <title>Parameter Syntax</title>
1744
1745 <para>Unit commands listed above take either a single unit name (designated as <replaceable>NAME</replaceable>),
1746 or multiple unit specifications (designated as <replaceable>PATTERN</replaceable>...). In the first case, the
1747 unit name with or without a suffix must be given. If the suffix is not specified (unit name is "abbreviated"),
1748 systemctl will append a suitable suffix, <literal>.service</literal> by default, and a type-specific suffix in
1749 case of commands which operate only on specific unit types. For example,
1750 <programlisting># systemctl start sshd</programlisting> and
1751 <programlisting># systemctl start sshd.service</programlisting>
1752 are equivalent, as are
1753 <programlisting># systemctl isolate default</programlisting>
1754 and
1755 <programlisting># systemctl isolate default.target</programlisting>
1756 Note that (absolute) paths to device nodes are automatically converted to device unit names, and other (absolute)
1757 paths to mount unit names.
1758 <programlisting># systemctl status /dev/sda
1759 # systemctl status /home</programlisting>
1760 are equivalent to:
1761 <programlisting># systemctl status dev-sda.device
1762 # systemctl status home.mount</programlisting>
1763 In the second case, shell-style globs will be matched against the primary names of all currently loaded units;
1764 literal unit names, with or without a suffix, will be treated as in the first case. This means that literal unit
1765 names always refer to exactly one unit, but globs may match zero units and this is not considered an
1766 error.</para>
1767
1768 <para>Glob patterns use
1769 <citerefentry project='man-pages'><refentrytitle>fnmatch</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
1770 so normal shell-style globbing rules are used, and
1771 <literal>*</literal>, <literal>?</literal>,
1772 <literal>[]</literal> may be used. See
1773 <citerefentry project='man-pages'><refentrytitle>glob</refentrytitle><manvolnum>7</manvolnum></citerefentry>
1774 for more details. The patterns are matched against the primary names of
1775 currently loaded units, and patterns which do not match anything
1776 are silently skipped. For example:
1777 <programlisting># systemctl stop sshd@*.service</programlisting>
1778 will stop all <filename>sshd@.service</filename> instances. Note that alias names of units, and units that aren't
1779 loaded are not considered for glob expansion.
1780 </para>
1781
1782 <para>For unit file commands, the specified <replaceable>NAME</replaceable> should be the name of the unit file
1783 (possibly abbreviated, see above), or the absolute path to the unit file:
1784 <programlisting># systemctl enable foo.service</programlisting>
1785 or
1786 <programlisting># systemctl link /path/to/foo.service</programlisting>
1787 </para>
1788 </refsect2>
1789
1790 </refsect1>
1791
1792 <refsect1>
1793 <title>Exit status</title>
1794
1795 <para>On success, 0 is returned, a non-zero failure
1796 code otherwise.</para>
1797 </refsect1>
1798
1799 <refsect1>
1800 <title>Environment</title>
1801
1802 <variablelist class='environment-variables'>
1803 <varlistentry>
1804 <term><varname>$SYSTEMD_EDITOR</varname></term>
1805
1806 <listitem><para>Editor to use when editing units; overrides
1807 <varname>$EDITOR</varname> and <varname>$VISUAL</varname>. If neither
1808 <varname>$SYSTEMD_EDITOR</varname> nor <varname>$EDITOR</varname> nor
1809 <varname>$VISUAL</varname> are present or if it is set to an empty
1810 string or if their execution failed, systemctl will try to execute well
1811 known editors in this order:
1812 <citerefentry project='die-net'><refentrytitle>editor</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1813 <citerefentry project='die-net'><refentrytitle>nano</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1814 <citerefentry project='die-net'><refentrytitle>vim</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1815 <citerefentry project='die-net'><refentrytitle>vi</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
1816 </para></listitem>
1817 </varlistentry>
1818 </variablelist>
1819 <xi:include href="less-variables.xml" xpointer="pager"/>
1820 <xi:include href="less-variables.xml" xpointer="less"/>
1821 </refsect1>
1822
1823 <refsect1>
1824 <title>See Also</title>
1825 <para>
1826 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1827 <citerefentry><refentrytitle>journalctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1828 <citerefentry><refentrytitle>loginctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1829 <citerefentry><refentrytitle>machinectl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1830 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1831 <citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1832 <citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
1833 <citerefentry project='man-pages'><refentrytitle>wall</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1834 <citerefentry><refentrytitle>systemd.preset</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1835 <citerefentry><refentrytitle>systemd.generator</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
1836 <citerefentry project='man-pages'><refentrytitle>glob</refentrytitle><manvolnum>7</manvolnum></citerefentry>
1837 </para>
1838 </refsect1>
1839
1840 </refentry>