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