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