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