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