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">
6 This file is part of systemd.
8 Copyright 2010 Lennart Poettering
10 systemd is free software; you can redistribute it and/or modify it
11 under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
15 systemd is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
20 You should have received a copy of the GNU Lesser General Public License
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
24 <refentry id="systemctl"
25 xmlns:xi="http://www.w3.org/2001/XInclude">
28 <title>systemctl</title>
29 <productname>systemd</productname>
33 <contrib>Developer</contrib>
34 <firstname>Lennart</firstname>
35 <surname>Poettering</surname>
36 <email>lennart@poettering.net</email>
42 <refentrytitle>systemctl</refentrytitle>
43 <manvolnum>1</manvolnum>
47 <refname>systemctl</refname>
48 <refpurpose>Control the systemd system and service manager</refpurpose>
53 <command>systemctl</command>
54 <arg choice="opt" rep="repeat">OPTIONS</arg>
55 <arg choice="plain">COMMAND</arg>
56 <arg choice="opt" rep="repeat">NAME</arg>
61 <title>Description</title>
63 <para><command>systemctl</command> may be used to introspect and
64 control the state of the <literal>systemd</literal> system and
65 service manager. Please refer to
66 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>
67 for an introduction into the basic concepts and functionality this
72 <title>Options</title>
74 <para>The following options are understood:</para>
78 <term><option>-t</option></term>
79 <term><option>--type=</option></term>
82 <para>The argument should be a comma-separated list of unit
83 types such as <option>service</option> and
84 <option>socket</option>.
87 <para>If one of the arguments is a unit type, when listing
88 units, limit display to certain unit types. Otherwise, units
89 of all types will be shown.</para>
91 <para>As a special case, if one of the arguments is
92 <option>help</option>, a list of allowed values will be
93 printed and the program will exit.</para>
98 <term><option>--state=</option></term>
101 <para>The argument should be a comma-separated list of unit
102 LOAD, SUB, or ACTIVE states. When listing units, show only
103 those in specified states. Use <option>--state=failed</option>
104 to show only failed units.</para>
109 <term><option>-p</option></term>
110 <term><option>--property=</option></term>
113 <para>When showing unit/job/manager properties with the
114 <command>show</command> command, limit display to certain
115 properties as specified as argument. If not specified, all
116 set properties are shown. The argument should be a
117 comma-separated list of property names, such as
118 <literal>MainPID</literal>. If specified more than once, all
119 properties with the specified names are shown.</para>
124 <term><option>-a</option></term>
125 <term><option>--all</option></term>
128 <para>When listing units, show all loaded units, regardless
129 of their state, including inactive units. When showing
130 unit/job/manager properties, show all properties regardless
131 whether they are set or not.</para>
132 <para>To list all units installed on the system, use the
133 <command>list-unit-files</command> command instead.</para>
138 <term><option>-r</option></term>
139 <term><option>--recursive</option></term>
142 <para>When listing units, also show units of local
143 containers. Units of local containers will be prefixed with
144 the container name, separated by a single colon character
145 (<literal>:</literal>).</para>
150 <term><option>--reverse</option></term>
153 <para>Show reverse dependencies between units with
154 <command>list-dependencies</command>, i.e. follow
155 dependencies of type <varname>WantedBy=</varname>,
156 <varname>RequiredBy=</varname>,
157 <varname>RequiredByOverrridable=</varname>,
158 <varname>PartOf=</varname>, <varname>BoundBy=</varname>,
159 instead of <varname>Wants=</varname> and similar.
165 <term><option>--after</option></term>
168 <para>With <command>list-dependencies</command>, show the
169 units that are ordered before the specified unit. In other
170 words, recursively list units following the
171 <varname>After=</varname> dependency.</para>
173 <para>Note that any <varname>After=</varname> dependency is
174 automatically mirrored to create a
175 <varname>Before=</varname> dependency. Temporal dependencies
176 may be specified explicitly, but are also created implicitly
177 for units which are <varname>WantedBy=</varname> targets
179 <citerefentry><refentrytitle>systemd.target</refentrytitle><manvolnum>5</manvolnum></citerefentry>),
180 and as a result of other directives (for example
181 <varname>RequiresMountsFor=</varname>). Both explicitly
182 and implicitly introduced dependencies are shown with
183 <command>list-dependencies</command>.</para>
188 <term><option>--before</option></term>
191 <para>With <command>list-dependencies</command>, show the
192 units that are ordered after the specified unit. In other
193 words, recursively list units following the
194 <varname>Before=</varname> dependency.</para>
199 <term><option>-l</option></term>
200 <term><option>--full</option></term>
203 <para>Do not ellipsize unit names, process tree entries,
204 journal output, or truncate unit descriptions in the output
205 of <command>status</command>, <command>list-units</command>,
206 <command>list-jobs</command>, and
207 <command>list-timers</command>.</para>
212 <term><option>--show-types</option></term>
215 <para>When showing sockets, show the type of the socket.</para>
220 <term><option>--job-mode=</option></term>
223 <para>When queuing a new job, this option controls how to deal with
224 already queued jobs. It takes one of <literal>fail</literal>,
225 <literal>replace</literal>,
226 <literal>replace-irreversibly</literal>,
227 <literal>isolate</literal>,
228 <literal>ignore-dependencies</literal>,
229 <literal>ignore-requirements</literal> or
230 <literal>flush</literal>. Defaults to
231 <literal>replace</literal>, except when the
232 <command>isolate</command> command is used which implies the
233 <literal>isolate</literal> job mode.</para>
235 <para>If <literal>fail</literal> is specified and a requested
236 operation conflicts with a pending job (more specifically:
237 causes an already pending start job to be reversed into a stop
238 job or vice versa), cause the operation to fail.</para>
240 <para>If <literal>replace</literal> (the default) is
241 specified, any conflicting pending job will be replaced, as
244 <para>If <literal>replace-irreversibly</literal> is specified,
245 operate like <literal>replace</literal>, but also mark the new
246 jobs as irreversible. This prevents future conflicting
247 transactions from replacing these jobs (or even being enqueued
248 while the irreversible jobs are still pending). Irreversible
249 jobs can still be cancelled using the <command>cancel</command>
252 <para><literal>isolate</literal> is only valid for start
253 operations and causes all other units to be stopped when the
254 specified unit is started. This mode is always used when the
255 <command>isolate</command> command is used.</para>
257 <para><literal>flush</literal> will cause all queued jobs to
258 be canceled when the new job is enqueued.</para>
260 <para>If <literal>ignore-dependencies</literal> is specified,
261 then all unit dependencies are ignored for this new job and
262 the operation is executed immediately. If passed, no required
263 units of the unit passed will be pulled in, and no ordering
264 dependencies will be honored. This is mostly a debugging and
265 rescue tool for the administrator and should not be used by
268 <para><literal>ignore-requirements</literal> is similar to
269 <literal>ignore-dependencies</literal>, but only causes the
270 requirement dependencies to be ignored, the ordering
271 dependencies will still be honoured.</para>
277 <term><option>-i</option></term>
278 <term><option>--ignore-inhibitors</option></term>
281 <para>When system shutdown or a sleep state is requested,
282 ignore inhibitor locks. Applications can establish inhibitor
283 locks to avoid that certain important operations (such as CD
284 burning or suchlike) are interrupted by system shutdown or a
285 sleep state. Any user may take these locks and privileged
286 users may override these locks. If any locks are taken,
287 shutdown and sleep state requests will normally fail
288 (regardless of whether privileged or not) and a list of active locks
289 is printed. However, if <option>--ignore-inhibitors</option>
290 is specified, the locks are ignored and not printed, and the
291 operation attempted anyway, possibly requiring additional
297 <term><option>-q</option></term>
298 <term><option>--quiet</option></term>
301 <para>Suppress output to standard output in
302 <command>snapshot</command>,
303 <command>is-active</command>,
304 <command>is-failed</command>,
305 <command>is-enabled</command>,
306 <command>is-system-running</command>,
307 <command>enable</command> and
308 <command>disable</command>.</para>
313 <term><option>--no-block</option></term>
316 <para>Do not synchronously wait for the requested operation
317 to finish. If this is not specified, the job will be
318 verified, enqueued and <command>systemctl</command> will
319 wait until it is completed. By passing this argument, it is
320 only verified and enqueued.</para>
325 <term><option>--no-legend</option></term>
328 <para>Do not print the legend, i.e. the column headers and
329 the footer with hints.</para>
333 <xi:include href="user-system-options.xml" xpointer="user" />
334 <xi:include href="user-system-options.xml" xpointer="system" />
336 <!-- we do not document -failed here, as it has been made
337 redundant by -state=failed, which it predates. To keep
338 things simple we only document the new switch, while
339 keeping the old one around for compatibility only. -->
342 <term><option>--no-wall</option></term>
345 <para>Do not send wall message before halt, power-off,
351 <term><option>--global</option></term>
354 <para>When used with <command>enable</command> and
355 <command>disable</command>, operate on the global user
356 configuration directory, thus enabling or disabling a unit
357 file globally for all future logins of all users.</para>
362 <term><option>--no-reload</option></term>
365 <para>When used with <command>enable</command> and
366 <command>disable</command>, do not implicitly reload daemon
367 configuration after executing the changes.</para>
372 <term><option>--no-ask-password</option></term>
375 <para>When used with <command>start</command> and related
376 commands, disables asking for passwords. Background services
377 may require input of a password or passphrase string, for
378 example to unlock system hard disks or cryptographic
379 certificates. Unless this option is specified and the
380 command is invoked from a terminal,
381 <command>systemctl</command> will query the user on the
382 terminal for the necessary secrets. Use this option to
383 switch this behavior off. In this case, the password must be
384 supplied by some other means (for example graphical password
385 agents) or the service might fail. This also disables
386 querying the user for authentication for privileged
393 <term><option>--kill-who=</option></term>
396 <para>When used with <command>kill</command>, choose which
397 processes to send a signal to. Must be one of
398 <option>main</option>, <option>control</option> or
399 <option>all</option> to select whether to kill only the main
400 process, the control process or all processes of the
401 unit. The main process of the unit is the one that defines
402 the life-time of it. A control process of a unit is one that
403 is invoked by the manager to induce state changes of it. For
404 example, all processes started due to the
405 <varname>ExecStartPre=</varname>,
406 <varname>ExecStop=</varname> or
407 <varname>ExecReload=</varname> settings of service units are
408 control processes. Note that there is only one control
409 process per unit at a time, as only one state change is
410 executed at a time. For services of type
411 <varname>Type=forking</varname>, the initial process started
412 by the manager for <varname>ExecStart=</varname> is a
413 control process, while the process ultimately forked off by
414 that one is then considered the main process of the unit (if
415 it can be determined). This is different for service units
416 of other types, where the process forked off by the manager
417 for <varname>ExecStart=</varname> is always the main process
418 itself. A service unit consists of zero or one main process,
419 zero or one control process plus any number of additional
420 processes. Not all unit types manage processes of these
421 types however. For example, for mount units, control processes
422 are defined (which are the invocations of
423 <filename>/usr/bin/mount</filename> and
424 <filename>/usr/bin/umount</filename>), but no main process
425 is defined. If omitted, defaults to
426 <option>all</option>.</para>
432 <term><option>-s</option></term>
433 <term><option>--signal=</option></term>
436 <para>When used with <command>kill</command>, choose which
437 signal to send to selected processes. Must be one of the
438 well known signal specifiers such as <constant>SIGTERM</constant>, <constant>SIGINT</constant> or
439 <constant>SIGSTOP</constant>. If omitted, defaults to
440 <option>SIGTERM</option>.</para>
445 <term><option>-f</option></term>
446 <term><option>--force</option></term>
449 <para>When used with <command>enable</command>, overwrite
450 any existing conflicting symlinks.</para>
452 <para>When used with <command>halt</command>,
453 <command>poweroff</command>, <command>reboot</command> or
454 <command>kexec</command>, execute the selected operation
455 without shutting down all units. However, all processes will
456 be killed forcibly and all file systems are unmounted or
457 remounted read-only. This is hence a drastic but relatively
458 safe option to request an immediate reboot. If
459 <option>--force</option> is specified twice for these
460 operations, they will be executed immediately without
461 terminating any processes or unmounting any file
462 systems. Warning: specifying <option>--force</option> twice
463 with any of these operations might result in data
469 <term><option>--root=</option></term>
473 <command>enable</command>/<command>disable</command>/<command>is-enabled</command>
474 (and related commands), use alternative root path when
475 looking for unit files.</para>
481 <term><option>--runtime</option></term>
484 <para>When used with <command>enable</command>,
485 <command>disable</command>, <command>edit</command>,
486 (and related commands), make changes only temporarily, so
487 that they are lost on the next reboot. This will have the
488 effect that changes are not made in subdirectories of
489 <filename>/etc</filename> but in <filename>/run</filename>,
490 with identical immediate effects, however, since the latter
491 is lost on reboot, the changes are lost too.</para>
493 <para>Similarly, when used with
494 <command>set-property</command>, make changes only
495 temporarily, so that they are lost on the next
501 <term><option>--preset-mode=</option></term>
504 <para>Takes one of <literal>full</literal> (the default),
505 <literal>enable-only</literal>,
506 <literal>disable-only</literal>. When used with the
507 <command>preset</command> or <command>preset-all</command>
508 commands, controls whether units shall be disabled and
509 enabled according to the preset rules, or only enabled, or
510 only disabled.</para>
515 <term><option>-n</option></term>
516 <term><option>--lines=</option></term>
519 <para>When used with <command>status</command>, controls the
520 number of journal lines to show, counting from the most
521 recent ones. Takes a positive integer argument. Defaults to
527 <term><option>-o</option></term>
528 <term><option>--output=</option></term>
531 <para>When used with <command>status</command>, controls the
532 formatting of the journal entries that are shown. For the
533 available choices, see
534 <citerefentry><refentrytitle>journalctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
535 Defaults to <literal>short</literal>.</para>
540 <term><option>--plain</option></term>
543 <para>When used with <command>list-dependencies</command>,
544 the output is printed as a list instead of a tree.</para>
548 <xi:include href="user-system-options.xml" xpointer="host" />
549 <xi:include href="user-system-options.xml" xpointer="machine" />
551 <xi:include href="standard-options.xml" xpointer="help" />
552 <xi:include href="standard-options.xml" xpointer="version" />
553 <xi:include href="standard-options.xml" xpointer="no-pager" />
558 <title>Commands</title>
560 <para>The following commands are understood:</para>
563 <title>Unit Commands</title>
567 <term><command>list-units <optional><replaceable>PATTERN</replaceable>...</optional></command></term>
570 <para>List known units (subject to limitations specified
571 with <option>-t</option>). If one or more
572 <replaceable>PATTERN</replaceable>s are specified, only
573 units matching one of them are shown.</para>
575 <para>This is the default command.</para>
580 <term><command>list-sockets <optional><replaceable>PATTERN</replaceable>...</optional></command></term>
583 <para>List socket units ordered by listening address.
584 If one or more <replaceable>PATTERN</replaceable>s are
585 specified, only socket units matching one of them are
586 shown. Produces output similar to
588 LISTEN UNIT ACTIVATES
589 /dev/initctl systemd-initctl.socket systemd-initctl.service
591 [::]:22 sshd.socket sshd.service
592 kobject-uevent 1 systemd-udevd-kernel.socket systemd-udevd.service
594 5 sockets listed.</programlisting>
595 Note: because the addresses might contains spaces, this output
596 is not suitable for programmatic consumption.
599 <para>See also the options <option>--show-types</option>,
600 <option>--all</option>, and <option>--state=</option>.</para>
605 <term><command>list-timers <optional><replaceable>PATTERN</replaceable>...</optional></command></term>
608 <para>List timer units ordered by the time they elapse
609 next. If one or more <replaceable>PATTERN</replaceable>s
610 are specified, only units matching one of them are shown.
613 <para>See also the options <option>--all</option> and
614 <option>--state=</option>.</para>
619 <term><command>start <replaceable>PATTERN</replaceable>...</command></term>
622 <para>Start (activate) one or more units specified on the
625 <para>Note that glob patterns operate on a list of currently
626 loaded units. Units which are not active and are not in a
627 failed state usually are not loaded, and would not be
628 matched by any pattern. In addition, in case of
629 instantiated units, systemd is often unaware of the
630 instance name until the instance has been started. Therefore,
631 using glob patterns with <command>start</command>
632 has limited usefulness.</para>
636 <term><command>stop <replaceable>PATTERN</replaceable>...</command></term>
639 <para>Stop (deactivate) one or more units specified on the
644 <term><command>reload <replaceable>PATTERN</replaceable>...</command></term>
647 <para>Asks all units listed on the command line to reload
648 their configuration. Note that this will reload the
649 service-specific configuration, not the unit configuration
650 file of systemd. If you want systemd to reload the
651 configuration file of a unit, use the
652 <command>daemon-reload</command> command. In other words:
653 for the example case of Apache, this will reload Apache's
654 <filename>httpd.conf</filename> in the web server, not the
655 <filename>apache.service</filename> systemd unit
658 <para>This command should not be confused with the
659 <command>daemon-reload</command> command.</para>
664 <term><command>restart <replaceable>PATTERN</replaceable>...</command></term>
667 <para>Restart one or more units specified on the command
668 line. If the units are not running yet, they will be
673 <term><command>try-restart <replaceable>PATTERN</replaceable>...</command></term>
676 <para>Restart one or more units specified on the command
677 line if the units are running. This does nothing if units are not
678 running. Note that, for compatibility with Red Hat init
679 scripts, <command>condrestart</command> is equivalent to this
684 <term><command>reload-or-restart <replaceable>PATTERN</replaceable>...</command></term>
687 <para>Reload one or more units if they support it. If not,
688 restart them instead. If the units are not running yet, they
689 will be started.</para>
693 <term><command>reload-or-try-restart <replaceable>PATTERN</replaceable>...</command></term>
696 <para>Reload one or more units if they support it. If not,
697 restart them instead. This does nothing if the units are not
698 running. Note that, for compatibility with SysV init scripts,
699 <command>force-reload</command> is equivalent to this
704 <term><command>isolate <replaceable>NAME</replaceable></command></term>
707 <para>Start the unit specified on the command line and its
708 dependencies and stop all others. If a unit name with no
709 extension is given, an extension of
710 <literal>.target</literal> will be assumed.</para>
712 <para>This is similar to changing the runlevel in a
713 traditional init system. The <command>isolate</command>
714 command will immediately stop processes that are not enabled
715 in the new unit, possibly including the graphical
716 environment or terminal you are currently using.</para>
718 <para>Note that this is allowed only on units where
719 <option>AllowIsolate=</option> is enabled. See
720 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
725 <term><command>kill <replaceable>PATTERN</replaceable>...</command></term>
728 <para>Send a signal to one or more processes of the
729 unit. Use <option>--kill-who=</option> to select which
730 process to kill. Use <option>--signal=</option> to select
731 the signal to send.</para>
735 <term><command>is-active <replaceable>PATTERN</replaceable>...</command></term>
738 <para>Check whether any of the specified units are active
739 (i.e. running). Returns an exit code
740 <constant>0</constant> if at least one is active, or
741 non-zero otherwise. Unless <option>--quiet</option> is
742 specified, this will also print the current unit state to
743 standard output.</para>
747 <term><command>is-failed <replaceable>PATTERN</replaceable>...</command></term>
750 <para>Check whether any of the specified units are in a
751 "failed" state. Returns an exit code
752 <constant>0</constant> if at least one has failed,
753 non-zero otherwise. Unless <option>--quiet</option> is
754 specified, this will also print the current unit state to
755 standard output.</para>
759 <term><command>status</command> <optional><replaceable>PATTERN</replaceable>...|<replaceable>PID</replaceable>...]</optional></term>
762 <para>Show terse runtime status information about one or
763 more units, followed by most recent log data from the
764 journal. If no units are specified, show system status. If
765 combined with <option>--all</option>, also show the status of
766 all units (subject to limitations specified with
767 <option>-t</option>). If a PID is passed, show information
768 about the unit the process belongs to.</para>
770 <para>This function is intended to generate human-readable
771 output. If you are looking for computer-parsable output,
772 use <command>show</command> instead. By default this
773 function only shows 10 lines of output and ellipsizes
774 lines to fit in the terminal window. This can be changes
775 with <option>--lines</option> and <option>--full</option>,
776 see above. In addition, <command>journalctl
777 --unit=<replaceable>NAME</replaceable></command> or
779 --user-unit=<replaceable>NAME</replaceable></command> use
780 a similar filter for messages and might be more
786 <term><command>show</command> <optional><replaceable>PATTERN</replaceable>...|<replaceable>JOB</replaceable>...</optional></term>
789 <para>Show properties of one or more units, jobs, or the
790 manager itself. If no argument is specified, properties of
791 the manager will be shown. If a unit name is specified,
792 properties of the unit is shown, and if a job id is
793 specified, properties of the job is shown. By default, empty
794 properties are suppressed. Use <option>--all</option> to
795 show those too. To select specific properties to show, use
796 <option>--property=</option>. This command is intended to be
797 used whenever computer-parsable output is required. Use
798 <command>status</command> if you are looking for formatted
799 human-readable output.</para>
803 <term><command>cat <replaceable>PATTERN</replaceable>...</command></term>
806 <para>Show backing files of one or more units. Prints the
807 "fragment" and "drop-ins" (source files) of units. Each
808 file is preceded by a comment which includes the file
813 <term><command>set-property <replaceable>NAME</replaceable> <replaceable>ASSIGNMENT</replaceable>...</command></term>
816 <para>Set the specified unit properties at runtime where
817 this is supported. This allows changing configuration
818 parameter properties such as resource control settings at
819 runtime. Not all properties may be changed at runtime, but
820 many resource control settings (primarily those in
821 <citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>)
822 may. The changes are applied instantly, and stored on disk
823 for future boots, unless <option>--runtime</option> is
824 passed, in which case the settings only apply until the
825 next reboot. The syntax of the property assignment follows
826 closely the syntax of assignments in unit files.</para>
828 <para>Example: <command>systemctl set-property foobar.service CPUShares=777</command></para>
830 <para>Note that this command allows changing multiple
831 properties at the same time, which is preferable over
832 setting them individually. Like unit file configuration
833 settings, assigning the empty list to list parameters will
834 reset the list.</para>
839 <term><command>help <replaceable>PATTERN</replaceable>...|<replaceable>PID</replaceable>...</command></term>
842 <para>Show manual pages for one or more units, if
843 available. If a PID is given, the manual pages for the unit
844 the process belongs to are shown.</para>
849 <term><command>reset-failed [<replaceable>PATTERN</replaceable>...]</command></term>
852 <para>Reset the <literal>failed</literal> state of the
853 specified units, or if no unit name is passed, reset the state of all
854 units. When a unit fails in some way (i.e. process exiting
855 with non-zero error code, terminating abnormally or timing
856 out), it will automatically enter the
857 <literal>failed</literal> state and its exit code and status
858 is recorded for introspection by the administrator until the
859 service is restarted or reset with this command.</para>
865 <command>list-dependencies</command>
866 <optional><replaceable>NAME</replaceable></optional>
870 <para>Shows units required and wanted by the specified
871 unit. This recursively lists units following the
872 <varname>Requires=</varname>,
873 <varname>RequiresOverridable=</varname>,
874 <varname>Requisite=</varname>,
875 <varname>RequisiteOverridable=</varname>,
876 <varname>Wants=</varname>, <varname>BindsTo=</varname>
877 dependencies. If no unit is specified,
878 <filename>default.target</filename> is implied.</para>
880 <para>By default, only target units are recursively
881 expanded. When <option>--all</option> is passed, all other
882 units are recursively expanded as well.</para>
884 <para>Options <option>--reverse</option>,
885 <option>--after</option>, <option>--before</option>
886 may be used to change what types of dependencies
894 <title>Unit File Commands</title>
898 <term><command>list-unit-files <optional><replaceable>PATTERN...</replaceable></optional></command></term>
901 <para>List installed unit files. If one or more
902 <replaceable>PATTERN</replaceable>s are specified, only
903 units whose filename (just the last component of the path)
904 matches one of them are shown.</para>
909 <term><command>enable <replaceable>NAME</replaceable>...</command></term>
912 <para>Enable one or more unit files or unit file instances,
913 as specified on the command line. This will create a number
914 of symlinks as encoded in the <literal>[Install]</literal>
915 sections of the unit files. After the symlinks have been
916 created, the systemd configuration is reloaded (in a way that
917 is equivalent to <command>daemon-reload</command>) to ensure
918 the changes are taken into account immediately. Note that
919 this does <emphasis>not</emphasis> have the effect of also
920 starting any of the units being enabled. If this
921 is desired, a separate <command>start</command> command must
922 be invoked for the unit. Also note that in case of instance
923 enablement, symlinks named the same as instances are created in
924 the install location, however they all point to the same
925 template unit file.</para>
927 <para>This command will print the actions executed. This
928 output may be suppressed by passing <option>--quiet</option>.
931 <para>Note that this operation creates only the suggested
932 symlinks for the units. While this command is the
933 recommended way to manipulate the unit configuration
934 directory, the administrator is free to make additional
935 changes manually by placing or removing symlinks in the
936 directory. This is particularly useful to create
937 configurations that deviate from the suggested default
938 installation. In this case, the administrator must make sure
939 to invoke <command>daemon-reload</command> manually as
940 necessary to ensure the changes are taken into account.
943 <para>Enabling units should not be confused with starting
944 (activating) units, as done by the <command>start</command>
945 command. Enabling and starting units is orthogonal: units
946 may be enabled without being started and started without
947 being enabled. Enabling simply hooks the unit into various
948 suggested places (for example, so that the unit is
949 automatically started on boot or when a particular kind of
950 hardware is plugged in). Starting actually spawns the daemon
951 process (in case of service units), or binds the socket (in
952 case of socket units), and so on.</para>
954 <para>Depending on whether <option>--system</option>,
955 <option>--user</option>, <option>--runtime</option>,
956 or <option>--global</option> is specified, this enables the unit
957 for the system, for the calling user only, for only this boot of
958 the system, or for all future logins of all users, or only this
959 boot. Note that in the last case, no systemd daemon
960 configuration is reloaded.</para>
962 <para>Using <command>enable</command> on masked units
963 results in an error.</para>
968 <term><command>disable <replaceable>NAME</replaceable>...</command></term>
971 <para>Disables one or more units. This removes all symlinks
972 to the specified unit files from the unit configuration
973 directory, and hence undoes the changes made by
974 <command>enable</command>. Note however that this removes
975 all symlinks to the unit files (i.e. including manual
976 additions), not just those actually created by
977 <command>enable</command>. This call implicitly reloads the
978 systemd daemon configuration after completing the disabling
979 of the units. Note that this command does not implicitly
980 stop the units that are being disabled. If this is desired,
981 an additional <command>stop</command> command should be
982 executed afterwards.</para>
984 <para>This command will print the actions executed. This
985 output may be suppressed by passing <option>--quiet</option>.
988 <para>This command honors <option>--system</option>,
989 <option>--user</option>, <option>--runtime</option> and
990 <option>--global</option> in a similar way as
991 <command>enable</command>.</para>
996 <term><command>is-enabled <replaceable>NAME</replaceable>...</command></term>
999 <para>Checks whether any of the specified unit files are
1000 enabled (as with <command>enable</command>). Returns an
1001 exit code of 0 if at least one is enabled, non-zero
1002 otherwise. Prints the current enable status (see table).
1003 To suppress this output, use <option>--quiet</option>.
1008 <command>is-enabled</command> output
1014 <entry>Printed string</entry>
1015 <entry>Meaning</entry>
1016 <entry>Return value</entry>
1021 <entry><literal>enabled</literal></entry>
1022 <entry morerows='1'>Enabled through a symlink in <filename>.wants</filename> directory (permanently or just in <filename>/run</filename>).</entry>
1023 <entry morerows='1'>0</entry>
1026 <entry><literal>enabled-runtime</literal></entry>
1029 <entry><literal>linked</literal></entry>
1030 <entry morerows='1'>Made available through a symlink to the unit file (permanently or just in <filename>/run</filename>).</entry>
1031 <entry morerows='1'>1</entry>
1034 <entry><literal>linked-runtime</literal></entry>
1037 <entry><literal>masked</literal></entry>
1038 <entry morerows='1'>Disabled entirely (permanently or just in <filename>/run</filename>).</entry>
1039 <entry morerows='1'>1</entry>
1042 <entry><literal>masked-runtime</literal></entry>
1045 <entry><literal>static</literal></entry>
1046 <entry>Unit file is not enabled, and has no provisions for enabling in the <literal>[Install]</literal> section.</entry>
1050 <entry><literal>indirect</literal></entry>
1051 <entry>Unit file itself is not enabled, but it has a non-empty <varname>Also=</varname> setting in the <literal>[Install]</literal> section, listing other unit files that might be enabled.</entry>
1055 <entry><literal>disabled</literal></entry>
1056 <entry>Unit file is not enabled.</entry>
1067 <term><command>reenable <replaceable>NAME</replaceable>...</command></term>
1070 <para>Reenable one or more unit files, as specified on the
1071 command line. This is a combination of
1072 <command>disable</command> and <command>enable</command> and
1073 is useful to reset the symlinks a unit is enabled with to
1074 the defaults configured in the <literal>[Install]</literal>
1075 section of the unit file.</para>
1080 <term><command>preset <replaceable>NAME</replaceable>...</command></term>
1083 <para>Reset one or more unit files, as specified on the
1084 command line, to the defaults configured in the preset
1085 policy files. This has the same effect as
1086 <command>disable</command> or <command>enable</command>,
1087 depending how the unit is listed in the preset files.</para>
1089 <para>Use <option>--preset-mode=</option> to control
1090 whether units shall be enabled and disabled, or only
1091 enabled, or only disabled.</para>
1093 <para>For more information on the preset policy format,
1095 <citerefentry><refentrytitle>systemd.preset</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
1096 For more information on the concept of presets, please
1098 url="http://freedesktop.org/wiki/Software/systemd/Preset">Preset</ulink>
1104 <term><command>preset-all</command></term>
1107 <para>Resets all installed unit files to the defaults
1108 configured in the preset policy file (see above).</para>
1110 <para>Use <option>--preset-mode=</option> to control
1111 whether units shall be enabled and disabled, or only
1112 enabled, or only disabled.</para>
1117 <term><command>mask <replaceable>NAME</replaceable>...</command></term>
1120 <para>Mask one or more unit files, as specified on the
1121 command line. This will link these units to
1122 <filename>/dev/null</filename>, making it impossible to
1123 start them. This is a stronger version of
1124 <command>disable</command>, since it prohibits all kinds of
1125 activation of the unit, including enablement and manual
1126 activation. Use this option with care. This honors the
1127 <option>--runtime</option> option to only mask temporarily
1128 until the next reboot of the system.</para>
1133 <term><command>unmask <replaceable>NAME</replaceable>...</command></term>
1136 <para>Unmask one or more unit files, as specified on the
1137 command line. This will undo the effect of
1138 <command>mask</command>.</para>
1143 <term><command>add-wants <replaceable>TARGET</replaceable>
1144 <replaceable>NAME</replaceable>...</command></term>
1145 <term><command>add-requires <replaceable>TARGET</replaceable>
1146 <replaceable>NAME</replaceable>...</command></term>
1149 <para>Adds <literal>Wants=</literal> resp. <literal>Requires=</literal>
1150 dependency to the specified <replaceable>TARGET</replaceable> for
1151 one or more units. </para>
1153 <para>This command honors <option>--system</option>,
1154 <option>--user</option>, <option>--runtime</option> and
1155 <option>--global</option> in a similar way as
1156 <command>enable</command>.</para>
1162 <term><command>link <replaceable>FILENAME</replaceable>...</command></term>
1165 <para>Link a unit file that is not in the unit file search
1166 paths into the unit file search path. This requires an
1167 absolute path to a unit file. The effect of this can be
1168 undone with <command>disable</command>. The effect of this
1169 command is that a unit file is available for
1170 <command>start</command> and other commands although it
1171 is not installed directly in the unit search path.</para>
1176 <term><command>get-default</command></term>
1179 <para>Get the default target specified
1180 via <filename>default.target</filename> link.</para>
1185 <term><command>set-default <replaceable>NAME</replaceable></command></term>
1188 <para>Set the default target to boot into. Command links
1189 <filename>default.target</filename> to the given unit.</para>
1194 <term><command>edit <replaceable>NAME</replaceable>...</command></term>
1197 <para>Edit a drop-in snippet or a whole replacement file if
1198 <option>--full</option> is specified, to extend or override the
1199 specified unit.</para>
1201 <para>Depending on whether <option>--system</option> (the default),
1202 <option>--user</option>, or <option>--global</option> is specified,
1203 this creates a drop-in file for each unit either for the system,
1204 for the calling user or for all futures logins of all users. Then,
1205 the editor (see the "Environment" section below) is invoked on
1206 temporary files which will be written to the real location if the
1207 editor exits successfully.</para>
1209 <para>If <option>--full</option> is specified, this will copy the
1210 original units instead of creating drop-in files.</para>
1212 <para>If <option>--runtime</option> is specified, the changes will
1213 be made temporarily in <filename>/run</filename> and they will be
1214 lost on the next reboot.</para>
1216 <para>If the temporary file is empty upon exit the modification of
1217 the related unit is canceled</para>
1219 <para>After the units have been edited, systemd configuration is
1220 reloaded (in a way that is equivalent to <command>daemon-reload</command>).
1223 <para>Note that this command cannot be used to remotely edit units
1224 and that you cannot temporarily edit units which are in
1225 <filename>/etc</filename> since they take precedence over
1226 <filename>/run</filename>.</para>
1233 <title>Machine Commands</title>
1237 <term><command>list-machines <optional><replaceable>PATTERN</replaceable>...</optional></command></term>
1240 <para>List the host and all running local containers with
1241 their state. If one or more
1242 <replaceable>PATTERN</replaceable>s are specified, only
1243 containers matching one of them are shown.
1251 <title>Job Commands</title>
1255 <term><command>list-jobs <optional><replaceable>PATTERN...</replaceable></optional></command></term>
1258 <para>List jobs that are in progress. If one or more
1259 <replaceable>PATTERN</replaceable>s are specified, only
1260 jobs for units matching one of them are shown.</para>
1264 <term><command>cancel <replaceable>JOB</replaceable>...</command></term>
1267 <para>Cancel one or more jobs specified on the command line
1268 by their numeric job IDs. If no job ID is specified, cancel
1269 all pending jobs.</para>
1276 <title>Snapshot Commands</title>
1280 <term><command>snapshot <optional><replaceable>NAME</replaceable></optional></command></term>
1283 <para>Create a snapshot. If a snapshot name is specified,
1284 the new snapshot will be named after it. If none is
1285 specified, an automatic snapshot name is generated. In
1286 either case, the snapshot name used is printed to standard
1287 output, unless <option>--quiet</option> is specified.
1290 <para>A snapshot refers to a saved state of the systemd
1291 manager. It is implemented itself as a unit that is
1292 generated dynamically with this command and has dependencies
1293 on all units active at the time. At a later time, the user
1294 may return to this state by using the
1295 <command>isolate</command> command on the snapshot unit.
1298 <para>Snapshots are only useful for saving and restoring
1299 which units are running or are stopped, they do not
1300 save/restore any other state. Snapshots are dynamic and lost
1305 <term><command>delete <replaceable>PATTERN</replaceable>...</command></term>
1308 <para>Remove a snapshot previously created with
1309 <command>snapshot</command>.</para>
1316 <title>Environment Commands</title>
1320 <term><command>show-environment</command></term>
1323 <para>Dump the systemd manager environment block. The
1324 environment block will be dumped in straight-forward form
1325 suitable for sourcing into a shell script. This environment
1326 block will be passed to all processes the manager
1331 <term><command>set-environment <replaceable>VARIABLE=VALUE</replaceable>...</command></term>
1334 <para>Set one or more systemd manager environment variables,
1335 as specified on the command line.</para>
1339 <term><command>unset-environment <replaceable>VARIABLE</replaceable>...</command></term>
1342 <para>Unset one or more systemd manager environment
1343 variables. If only a variable name is specified, it will be
1344 removed regardless of its value. If a variable and a value
1345 are specified, the variable is only removed if it has the
1346 specified value.</para>
1350 <term><command>import-environment <replaceable>VARIABLE</replaceable>...</command></term>
1353 <para>Import all, one or more environment variables set on
1354 the client into the systemd manager environment block. If
1355 no arguments are passed, the entire environment block is
1356 imported. Otherwise, a list of one or more environment
1357 variable names should be passed, whose client-side values
1358 are then imported into the manager's environment
1366 <title>Manager Lifecycle Commands</title>
1370 <term><command>daemon-reload</command></term>
1373 <para>Reload systemd manager configuration. This will reload
1374 all unit files and recreate the entire dependency
1375 tree. While the daemon is being reloaded, all sockets systemd
1376 listens on behalf of user configuration will stay
1377 accessible.</para> <para>This command should not be confused
1378 with the <command>reload</command> command.</para>
1382 <term><command>daemon-reexec</command></term>
1385 <para>Reexecute the systemd manager. This will serialize the
1386 manager state, reexecute the process and deserialize the
1387 state again. This command is of little use except for
1388 debugging and package upgrades. Sometimes, it might be
1389 helpful as a heavy-weight <command>daemon-reload</command>.
1390 While the daemon is being reexecuted, all sockets systemd listening
1391 on behalf of user configuration will stay accessible.
1399 <title>System Commands</title>
1403 <term><command>is-system-running</command></term>
1406 <para>Checks whether the system is operational. This
1407 returns success when the system is fully up and running,
1408 meaning not in startup, shutdown or maintenance
1409 mode. Failure is returned otherwise. In addition, the
1410 current state is printed in a short string to standard
1411 output, see table below. Use <option>--quiet</option> to
1412 suppress this output.</para>
1415 <title>Manager Operational States</title>
1417 <colspec colname='name' />
1418 <colspec colname='description' />
1422 <entry>Description</entry>
1427 <entry><varname>initializing</varname></entry>
1428 <entry><para>Early bootup, before
1429 <filename>basic.target</filename> is reached
1430 or the <varname>maintenance</varname> state entered.
1434 <entry><varname>starting</varname></entry>
1435 <entry><para>Late bootup, before the job queue
1436 becomes idle for the first time, or one of the
1437 rescue targets are reached.</para></entry>
1440 <entry><varname>running</varname></entry>
1441 <entry><para>The system is fully
1442 operational.</para></entry>
1445 <entry><varname>degraded</varname></entry>
1446 <entry><para>The system is operational but one or more
1447 units failed.</para></entry>
1450 <entry><varname>maintenance</varname></entry>
1451 <entry><para>The rescue or emergency target is
1452 active.</para></entry>
1455 <entry><varname>stopping</varname></entry>
1456 <entry><para>The manager is shutting
1457 down.</para></entry>
1466 <term><command>default</command></term>
1469 <para>Enter default mode. This is mostly equivalent to
1470 <command>isolate default.target</command>.</para>
1475 <term><command>rescue</command></term>
1478 <para>Enter rescue mode. This is mostly equivalent to
1479 <command>isolate rescue.target</command>, but also prints a
1480 wall message to all users.</para>
1484 <term><command>emergency</command></term>
1487 <para>Enter emergency mode. This is mostly equivalent to
1488 <command>isolate emergency.target</command>, but also prints
1489 a wall message to all users.</para>
1493 <term><command>halt</command></term>
1496 <para>Shut down and halt the system. This is mostly equivalent to
1497 <command>start halt.target --irreversible</command>, but also
1498 prints a wall message to all users. If combined with
1499 <option>--force</option>, shutdown of all running services is
1500 skipped, however all processes are killed and all file
1501 systems are unmounted or mounted read-only, immediately
1502 followed by the system halt. If <option>--force</option> is
1503 specified twice, the operation is immediately executed
1504 without terminating any processes or unmounting any file
1505 systems. This may result in data loss.</para>
1509 <term><command>poweroff</command></term>
1512 <para>Shut down and power-off the system. This is mostly
1513 equivalent to <command>start poweroff.target --irreversible</command>,
1514 but also prints a wall message to all users. If combined with
1515 <option>--force</option>, shutdown of all running services is
1516 skipped, however all processes are killed and all file
1517 systems are unmounted or mounted read-only, immediately
1518 followed by the powering off. If <option>--force</option> is
1519 specified twice, the operation is immediately executed
1520 without terminating any processes or unmounting any file
1521 systems. This may result in data loss.</para>
1525 <term><command>reboot <optional><replaceable>arg</replaceable></optional></command></term>
1528 <para>Shut down and reboot the system. This is mostly
1529 equivalent to <command>start reboot.target --irreversible</command>,
1530 but also prints a wall message to all users. If combined with
1531 <option>--force</option>, shutdown of all running services is
1532 skipped, however all processes are killed and all file
1533 systems are unmounted or mounted read-only, immediately
1534 followed by the reboot. If <option>--force</option> is
1535 specified twice, the operation is immediately executed
1536 without terminating any processes or unmounting any file
1537 systems. This may result in data loss.</para>
1539 <para>If the optional argument
1540 <replaceable>arg</replaceable> is given, it will be passed
1541 as the optional argument to the
1542 <citerefentry><refentrytitle>reboot</refentrytitle><manvolnum>2</manvolnum></citerefentry>
1543 system call. The value is architecture and firmware
1544 specific. As an example, <literal>recovery</literal> might
1545 be used to trigger system recovery, and
1546 <literal>fota</literal> might be used to trigger a
1547 <quote>firmware over the air</quote> update.</para>
1551 <term><command>kexec</command></term>
1554 <para>Shut down and reboot the system via kexec. This is
1555 mostly equivalent to <command>start kexec.target --irreversible</command>,
1556 but also prints a wall message to all users. If combined
1557 with <option>--force</option>, shutdown of all running
1558 services is skipped, however all processes are killed and
1559 all file systems are unmounted or mounted read-only,
1560 immediately followed by the reboot.</para>
1564 <term><command>exit</command></term>
1567 <para>Ask the systemd manager to quit. This is only
1568 supported for user service managers (i.e. in conjunction
1569 with the <option>--user</option> option) and will fail
1575 <term><command>suspend</command></term>
1578 <para>Suspend the system. This will trigger activation of
1579 the special <filename>suspend.target</filename> target.
1584 <term><command>hibernate</command></term>
1587 <para>Hibernate the system. This will trigger activation of
1588 the special <filename>hibernate.target</filename> target.
1593 <term><command>hybrid-sleep</command></term>
1596 <para>Hibernate and suspend the system. This will trigger
1597 activation of the special
1598 <filename>hybrid-sleep.target</filename> target.</para>
1602 <term><command>switch-root <replaceable>ROOT</replaceable> <optional><replaceable>INIT</replaceable></optional></command></term>
1605 <para>Switches to a different root directory and executes a
1606 new system manager process below it. This is intended for
1607 usage in initial RAM disks ("initrd"), and will transition
1608 from the initrd's system manager process (a.k.a "init"
1609 process) to the main system manager process. This call takes two
1610 arguments: the directory that is to become the new root directory, and
1611 the path to the new system manager binary below it to
1612 execute as PID 1. If the latter is omitted or the empty
1613 string, a systemd binary will automatically be searched for
1614 and used as init. If the system manager path is omitted or
1615 equal to the empty string, the state of the initrd's system
1616 manager process is passed to the main system manager, which
1617 allows later introspection of the state of the services
1618 involved in the initrd boot.</para>
1625 <title>Parameter Syntax</title>
1627 <para>Unit commands listed above take either a single unit name
1628 (designated as <replaceable>NAME</replaceable>), or multiple
1629 unit specifications (designated as
1630 <replaceable>PATTERN</replaceable>...). In the first case, the
1631 unit name with or without a suffix must be given. If the suffix
1632 is not specified, systemctl will append a suitable suffix,
1633 <literal>.service</literal> by default, and a type-specific
1634 suffix in case of commands which operate only on specific unit
1636 <programlisting># systemctl start sshd</programlisting> and
1637 <programlisting># systemctl start sshd.service</programlisting>
1638 are equivalent, as are
1639 <programlisting># systemctl isolate default</programlisting>
1641 <programlisting># systemctl isolate default.target</programlisting>
1642 Note that (absolute) paths to device nodes are automatically
1643 converted to device unit names, and other (absolute) paths to
1645 <programlisting># systemctl status /dev/sda
1646 # systemctl status /home</programlisting>
1648 <programlisting># systemctl status dev-sda.device
1649 # systemctl status home.mount</programlisting>
1650 In the second case, shell-style globs will be matched against
1651 currently loaded units; literal unit names, with or without
1652 a suffix, will be treated as in the first case. This means that
1653 literal unit names always refer to exactly one unit, but globs
1654 may match zero units and this is not considered an error.</para>
1656 <para>Glob patterns use
1657 <citerefentry><refentrytitle>fnmatch</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
1658 so normal shell-style globbing rules are used, and
1659 <literal>*</literal>, <literal>?</literal>,
1660 <literal>[]</literal> may be used. See
1661 <citerefentry><refentrytitle>glob</refentrytitle><manvolnum>7</manvolnum></citerefentry>
1662 for more details. The patterns are matched against the names of
1663 currently loaded units, and patterns which do not match anything
1664 are silently skipped. For example:
1665 <programlisting># systemctl stop sshd@*.service</programlisting>
1666 will stop all <filename>sshd@.service</filename> instances.
1669 <para>For unit file commands, the specified
1670 <replaceable>NAME</replaceable> should be the full name of the
1671 unit file, or the absolute path to the unit file:
1672 <programlisting># systemctl enable foo.service</programlisting>
1674 <programlisting># systemctl link /path/to/foo.service</programlisting>
1681 <title>Exit status</title>
1683 <para>On success, 0 is returned, a non-zero failure
1684 code otherwise.</para>
1688 <title>Environment</title>
1690 <variablelist class='environment-variables'>
1692 <term><varname>$SYSTEMD_EDITOR</varname></term>
1694 <listitem><para>Editor to use when editing units; overrides
1695 <varname>$EDITOR</varname> and <varname>$VISUAL</varname>. If neither
1696 <varname>$SYSTEMD_EDITOR</varname> nor <varname>$EDITOR</varname> nor
1697 <varname>$VISUAL</varname> are present or if it is set to an empty
1698 string or if their execution failed, systemctl will try to execute well
1699 known editors in this order:
1700 <citerefentry><refentrytitle>nano</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1701 <citerefentry><refentrytitle>vim</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1702 <citerefentry><refentrytitle>vi</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
1706 <xi:include href="less-variables.xml" xpointer="pager"/>
1707 <xi:include href="less-variables.xml" xpointer="less"/>
1711 <title>See Also</title>
1713 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1714 <citerefentry><refentrytitle>systemadm</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1715 <citerefentry><refentrytitle>journalctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1716 <citerefentry><refentrytitle>loginctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1717 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1718 <citerefentry><refentrytitle>systemd.resource-management</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1719 <citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
1720 <citerefentry project='man-pages'><refentrytitle>wall</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1721 <citerefentry><refentrytitle>systemd.preset</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1722 <citerefentry><refentrytitle>glob</refentrytitle><manvolnum>7</manvolnum></citerefentry>