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