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