1 <?xml version='1.0'?> <!--*-nxml-*-->
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 General Public License as published by
12 the Free Software Foundation; either version 2 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 General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
24 <refentry id="systemctl">
27 <title>systemctl</title>
28 <productname>systemd</productname>
32 <contrib>Developer</contrib>
33 <firstname>Lennart</firstname>
34 <surname>Poettering</surname>
35 <email>lennart@poettering.net</email>
41 <refentrytitle>systemctl</refentrytitle>
42 <manvolnum>1</manvolnum>
46 <refname>systemctl</refname>
47 <refpurpose>Control the systemd system and session manager</refpurpose>
52 <command>systemctl <arg choice="opt" rep="repeat">OPTIONS</arg> <arg choice="req">COMMAND</arg> <arg choice="opt" rep="repeat">NAME</arg></command>
57 <title>Description</title>
59 <para><command>systemctl</command> may be used to
60 introspect and control the state of the
61 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>
62 system and session manager.</para>
66 <title>Options</title>
68 <para>The following options are understood:</para>
72 <term><option>--help</option></term>
73 <term><option>-h</option></term>
75 <listitem><para>Prints a short help
76 text and exits.</para></listitem>
80 <term><option>--type=</option></term>
81 <term><option>-t</option></term>
83 <listitem><para>When listing units,
84 limit display to certain unit
85 types. If not specified units of all
86 types will be shown. The argument
87 should be a unit type name such as
88 <option>service</option>,
89 <option>socket</option> and
90 similar.</para></listitem>
94 <term><option>--property=</option></term>
95 <term><option>-p</option></term>
97 <listitem><para>When showing
98 unit/job/manager information, limit
99 display to certain properties as
100 specified as argument. If not
101 specified all set properties are
102 shown. The argument should be a
103 property name, such as
104 <literal>MainPID</literal>. If
105 specified more than once all
106 properties with the specified names
107 are shown.</para></listitem>
111 <term><option>--all</option></term>
112 <term><option>-a</option></term>
114 <listitem><para>When listing units,
115 show all units, regardless of their
116 state, including inactive units. When
117 showing unit/job/manager information,
118 show all properties regardless whether
119 they are set or not.</para></listitem>
123 <term><option>--full</option></term>
125 <listitem><para>Do not ellipsize unit
126 names and truncate unit descriptions
128 <command>list-units</command> and
129 <command>list-jobs</command>.</para></listitem>
133 <term><option>--fail</option></term>
135 <listitem><para>If the requested
136 operation conflicts with a pending
137 unfinished job, fail the command. If
138 this is not specified the requested
139 operation will replace the pending job,
140 if necessary.</para></listitem>
144 <term><option>--quiet</option></term>
145 <term><option>-q</option></term>
147 <listitem><para>Suppress output to
149 <command>snapshot</command>,
150 <command>check</command>,
151 <command>enable</command> and
152 <command>disable</command>.</para></listitem>
156 <term><option>--no-block</option></term>
158 <listitem><para>Do not synchronously wait for
159 the requested operation to finish. If this is
160 not specified the job will be verified,
161 enqueued and <command>systemctl</command> will
162 wait until it is completed. By passing this
163 argument it is only verified and
164 enqueued.</para></listitem> </varlistentry>
167 <term><option>--system</option></term>
169 <listitem><para>Talk to the systemd
170 system manager. (Default)</para></listitem>
174 <term><option>--session</option></term>
176 <listitem><para>Talk to the systemd
177 session manager of the calling user.</para></listitem>
181 <term><option>--order</option></term>
182 <term><option>--require</option></term>
184 <listitem><para>When used in
186 <command>dot</command> command (see
187 below), selects which dependencies are
188 shown in the dependency graph. If
189 <option>--order</option> is passed
190 only dependencies of type
191 <varname>After=</varname> or
192 <varname>Before=</varname> are
193 shown. If <option>--require</option>
194 is passed only dependencies of type
195 <varname>Requires=</varname>,
196 <varname>RequiresOverridable=</varname>,
197 <varname>Requisite=</varname>,
198 <varname>RequisiteOverridable=</varname>,
199 <varname>Wants=</varname> and
200 <varname>Conflicts=</varname> are
201 shown. If neither is passed, shows
202 dependencies of all these
203 types.</para></listitem>
207 <term><option>--no-wall</option></term>
209 <listitem><para>Don't send wall
211 halt, power-off, reboot.</para></listitem>
215 <term><option>--global</option></term>
217 <listitem><para>When used with
218 <command>enable</command> and
219 <command>disable</command>, operate on the
220 global session configuŕation
221 directory, thus enabling or disabling
222 a unit file globally for all future
223 sessions of all users.</para></listitem>
227 <term><option>--no-reload</option></term>
229 <listitem><para>When used with
230 <command>enable</command> and
231 <command>disable</command>, do not
232 implicitly reload daemon configuration
234 changes.</para></listitem>
238 <term><option>--force</option></term>
240 <listitem><para>When used with
241 <command>enable</command>, override any
243 symlinks.</para></listitem>
247 <term><option>--defaults</option></term>
249 <listitem><para>When used with
250 <command>disable</command>, ensures
251 that only the symlinks created by
252 <command>enable</command> are removed,
253 not all symlinks pointing to the unit
255 disabled.</para></listitem>
259 <para>The following commands are understood:</para>
263 <term><command>list-units</command></term>
265 <listitem><para>List known units.</para></listitem>
268 <term><command>start [NAME...]</command></term>
270 <listitem><para>Start (activate) one
271 or more units specified on the command
272 line.</para></listitem>
275 <term><command>stop [NAME...]</command></term>
277 <listitem><para>Stop (deactivate) one
278 or more units specified on the command
279 line.</para></listitem>
282 <term><command>reload [NAME...]</command></term>
284 <listitem><para>Asks all units listed
285 on the command line to reload their
286 configuration. Note that this will
287 reload the service-specific
288 configuration, not the unit
289 configuration file of systemd. If you
290 want systemd to reload the
291 configuration file of a unit use the
292 <command>daemon-reload</command>
293 command. In other words: for the
294 example case of Apache, this will
296 <filename>httpd.conf</filename> in the
298 <filename>apache.service</filename>
299 systemd unit file. </para>
301 <para>This command should not be
303 <command>daemon-reload</command> or
304 <command>load</command>
305 commands.</para></listitem>
309 <term><command>restart [NAME...]</command></term>
311 <listitem><para>Restart one or more
312 units specified on the command
313 line. If the units are not running yet
315 started.</para></listitem>
318 <term><command>try-restart [NAME...]</command></term>
320 <listitem><para>Restart one or more
321 units specified on the command
322 line. If the units are not running yet
324 fail.</para></listitem>
327 <term><command>reload-or-restart [NAME...]</command></term>
328 <term><command>reload-or-try-restart [NAME...]</command></term>
330 <listitem><para>Reload one or more
331 units if they support it. If not,
332 restart them instead. Note that for
333 compatibility with SysV and Red Hat
335 <command>force-reload</command> and
336 <command>condrestart</command> may be
337 used as equivalent commands to
338 <command>reload-or-try-restart</command>.</para></listitem>
341 <term><command>isolate [NAME]</command></term>
343 <listitem><para>Start the unit
344 specified on the command line and its
345 dependencies and stop all others. Note
346 that this works only on units where
347 <option>AllowIsolate=</option> is
349 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
350 for details.</para></listitem>
353 <term><command>is-active [NAME...]</command></term>
355 <listitem><para>Check whether any of
356 the specified units is active
357 (i.e. running). Returns an exit code
358 0 if at least one is active, non-zero
360 <option>--quiet</option> is specified
361 this will also print the current unit
362 state to STDOUT.</para></listitem>
365 <term><command>status [NAME...|PID...]</command></term>
367 <listitem><para>Show terse runtime
368 status information about one or more
369 units. This function is intended to
370 generate human-readable output. If you
371 are looking for computer-parsable
372 output, use <command>show</command>
373 instead. If a PID is passed
374 information about the unit the process
375 of the PID belongs to is
376 shown.</para></listitem>
379 <term><command>show [NAME...|JOB...]</command></term>
381 <listitem><para>Show properties of one
382 or more units, jobs or the manager
383 itself. If no argument is specified
384 properties of the manager will be
385 shown. If a unit name is specified
386 properties of the unit is shown, and
387 if a job id is specified properties of
388 the job is shown. By default, empty
389 properties are suppressed. Use
390 <option>--all</option> to show those
391 too. To select specific properties to
393 <option>--property=</option>. This
394 command is intended to be used
395 whenever computer-parsable output is
397 <command>status</command> if you are
398 looking for formatted human-readable
399 output.</para></listitem>
403 <term><command>reset-failed [NAME...]</command></term>
405 <listitem><para>Reset the
406 '<literal>failed</literal>' state of the
407 specified units, or if no unit name is
408 passed of all units. When a unit fails
409 in some way (i.e. process exiting with
410 non-zero error code, terminating
411 abnormally or timing out) it will
412 automatically enter the
413 '<literal>failed</literal>' state and
414 its exit code and status is recorded
415 for introspection by the administrator
416 until the service is restarted or
418 command.</para></listitem>
422 <term><command>enable [NAME...]</command></term>
424 <listitem><para>Enable one or more
425 unit files, as specified on the
426 command line. This will create a
427 number of symlinks as encoded in the
428 <literal>[Install]</literal> sections
429 of the unit files. After the symlinks
430 have been created the systemd
431 configuration is reloaded (in a way
432 that is equivalent to
433 <command>daemon-reload</command>) to
434 ensure the changes are taken into
435 account immediately. Note that this
436 does not have the effect that any of
437 the units enabled are also started at
438 the same time. If this is desired a
439 seperate <command>start</command>
440 command must be invoked for the
443 <para>This command will
444 print the actions executed. This
445 output may be suppressed by passing
446 <option>--quiet</option>.</para>
448 <para>Note that this operation creates
449 only the suggested symlinks for the
450 units. While this command is the
451 recommended way to manipulate the unit
452 configuration directory, the
453 administrator is free to make
454 additional changes manually, by
455 placing or removing symlinks in the
456 directory. This is particular useful
457 to create configurations that deviate
458 from the suggested default
459 installation. In this case the
460 administrator must make sure to invoke
461 <command>daemon-reload</command>
462 manually as necessary, to ensure his
463 changes are taken into account.</para>
465 <para>Enabling units should not be
466 confused with starting (activating)
467 units, as done by the
468 <command>start</command>
469 command. Enabling and starting units
470 is orthogonal: units may be enabled
471 without being started and started
472 without being enabled. Enabling simply
473 hooks the unit into various suggested
474 places (for example, so that the unit
475 is automatically started on boot or
476 when a particular kind of hardware is
477 plugged in). Starting actually spawns
478 the daemon process (in case of service
479 units), or binds the socket (in case
480 of socket units), and so
483 <para>Depending on whether
484 <option>--system</option>,
485 <option>--session</option> or
486 <option>--global</option> is specified
487 this enables the unit for the system,
488 for sessions of the calling user only
489 or for all future session of all
490 users. Note that in the latter case no
491 systemd daemon configuration is
497 <term><command>disable [NAME...]</command></term>
499 <listitem><para>Disables one or more
500 units. This removes all symlinks to
501 the specified unit files from the unit
502 configuration directory, and hence
503 undoes the changes made by
504 <command>enable</command>. Note
505 however that this by default removes
506 all symlinks to the unit files
507 (i.e. including manual additions), not
508 just those actually created by
509 <command>enable</command>. If only the
510 symlinks that are suggested by default
511 shall be removed, pass
512 <option>--defaults</option>. This
513 implicitly reloads the systemd daemon
514 configuration after completing the
515 disabling of the units. Note that this
516 command does not implicitly stop the
517 units that is being disabled. If this
518 is desired an additional
519 <command>stop</command>command should
520 be executed afterwards.</para>
522 <para>This command will print the
523 actions executed. This output may be
524 suppressed by passing
525 <option>--quiet</option>.</para>
528 <para>This command honours
529 <option>--system</option>,
530 <option>--session</option>,
531 <option>--global</option> in a similar
533 <command>enable</command>.</para>
537 <term><command>is-enabled [NAME...]</command></term>
539 <listitem><para>Checks whether any of
540 the specified unit files is enabled
542 <command>enable</command>). Returns an
543 exit code of 0 if at least one is
545 otherwise.</para></listitem>
549 <term><command>load [NAME...]</command></term>
551 <listitem><para>Load one or more units
552 specified on the command line. This
553 will simply load their configuration
554 from disk, but not start them. To
555 start them you need to use the
556 <command>start</command> command which
557 will implicitly load a unit that has
558 not been loaded yet. Note that systemd
559 garbage collects loaded units that are
560 not active or referenced by an active
561 unit. This means that units loaded
562 this way will usually not stay loaded
563 for long. Also note that this command
564 cannot be used to reload unit
565 configuration. Use the
566 <command>daemon-reload</command>
567 command for that. All in all, this
568 command is of little use except for
570 <para>This command should not be
572 <command>daemon-reload</command> or
573 <command>reload</command>
574 commands.</para></listitem>
577 <term><command>list-jobs</command></term>
579 <listitem><para>List jobs that are in progress.</para></listitem>
582 <term><command>cancel [JOB...]</command></term>
584 <listitem><para>Cancel one or more
585 jobs specified on the command line by
587 IDs. If not job id is specified cancels all jobs that are pending.</para></listitem>
590 <term><command>monitor</command></term>
592 <listitem><para>Monitor unit/job
593 changes. This is mostly useful for
594 debugging purposes and prints a line
595 each time systemd loads or unloads a
596 unit configuration file, or a unit
597 property changes.</para></listitem>
600 <term><command>dump</command></term>
602 <listitem><para>Dump server
603 status. This will output a (usually
604 very long) human readable manager
605 status dump. Its format is subject to
606 change without notice and should not
608 applications.</para></listitem>
611 <term><command>dot</command></term>
613 <listitem><para>Generate textual
614 dependency graph description in dot
615 format for further processing with the
617 <citerefentry><refentrytitle>dot</refentrytitle><manvolnum>1</manvolnum></citerefentry>
618 tool. Use a command line like
619 <command>systemctl dot | dot -Tsvg >
620 systemd.svg</command> to generate a
621 graphical dependency tree. Unless
622 <option>--order</option> or
623 <option>--require</option> is passed
624 the generated graph will show both
625 ordering and requirement
626 dependencies.</para></listitem>
629 <term><command>snapshot [NAME]</command></term>
631 <listitem><para>Create a snapshot. If
632 a snapshot name is specified, the new
633 snapshot will be named after it. If
634 none is specified an automatic
635 snapshot name is generated. In either
636 case, the snapshot name used is
637 printed to STDOUT, unless
638 <option>--quiet</option> is
641 <para>A snapshot refers to a saved
642 state of the systemd manager. It is
643 implemented itself as unit that is
644 generated dynamically with this
645 command and has dependencies on all
646 units active at the time. At a later
647 time the user may return to this state
649 <command>isolate</command> command on
650 the snapshot unit.</para></listitem>
652 <para>Snapshots are only useful for
653 saving and restoring which units are
654 running or are stopped, they do not
655 save/restore any other
656 state. Snapshots are dynamic and lost
660 <term><command>delete [NAME...]</command></term>
662 <listitem><para>Remove a snapshot
663 previously created with
664 <command>snapshot</command>.</para></listitem>
667 <term><command>daemon-reload</command></term>
669 <listitem><para>Reload systemd manager
670 configuration. This will reload all
671 unit files and recreate the entire
672 dependency tree. While the daemon is
673 reloaded, all sockets systemd listens
674 on on behalf of user configuration will
675 stay accessible.</para> <para>This
676 command should not be confused with
677 the <command>load</command> or
678 <command>reload</command>
679 commands.</para></listitem>
682 <term><command>daemon-reexec</command></term>
684 <listitem><para>Reexecute the systemd
685 manager. This will serialize the
686 manager state, reexecute the process
687 and deserialize the state again. This
688 command is of little use except for
689 debugging and package
690 upgrades. Sometimes it might be
691 helpful as a heavy-weight
692 <command>daemon-reload</command>. While
693 the daemon is reexecuted all sockets
694 systemd listens on on behalf of user
695 configuration will stay
696 accessible.</para></listitem>
699 <term><command>daemon-exit</command></term>
701 <listitem><para>Ask the systemd
702 manager to quit. This is only
703 supported for session managers
704 (i.e. in conjunction with the
705 <option>--session</option> option) and
706 will fail otherwise.</para></listitem>
709 <term><command>show-environment</command></term>
711 <listitem><para>Dump the systemd
712 manager environment block. The
713 environment block will be dumped in
714 straight-forward form suitable for
715 sourcing into a shell script. This
716 environment block will be passed to
717 all processes the manager
718 spawns.</para></listitem>
721 <term><command>set-environment [NAME=VALUE...]</command></term>
723 <listitem><para>Set one or more
724 systemd manager environment variables,
725 as specified on the command
726 line.</para></listitem>
729 <term><command>unset-environment [NAME...]</command></term>
731 <listitem><para>Unset one or more
732 systemd manager environment
733 variables. If only a variable name is
734 specified it will be removed
735 regardless of its value. If a variable
736 and a value are specified the variable
737 is only removed if it has the
738 specified value.</para></listitem>
742 <term><command>halt</command></term>
744 <listitem><para>Shut down and halt the
745 system. This is mostly equivalent to
746 <command>start halt.target</command>
747 but also prints a wall message to all
748 users.</para></listitem>
751 <term><command>poweroff</command></term>
753 <listitem><para>Shut down and
754 power-off the system. This is mostly
755 equivalent to <command>start
756 poweroff.target</command> but also
757 prints a wall message to all
758 users.</para></listitem>
761 <term><command>reboot</command></term>
763 <listitem><para>Shut down and
764 reboot the system. This is mostly
765 equivalent to <command>start
766 reboot.target</command> but also
767 prints a wall message to all
768 users.</para></listitem>
771 <term><command>default</command></term>
773 <listitem><para>Enter default
774 mode. This is mostly equivalent to
776 default.target</command>.</para></listitem>
779 <term><command>rescue</command></term>
781 <listitem><para>Enter rescue
782 mode. This is mostly equivalent to
784 rescue.target</command> but also
785 prints a wall message to all
786 users.</para></listitem>
789 <term><command>emergency</command></term>
791 <listitem><para>Enter emergency
792 mode. This is mostly equivalent to
794 emergency.target</command> but also
795 prints a wall message to all
796 users.</para></listitem>
803 <title>Exit status</title>
805 <para>On success 0 is returned, a non-zero failure
806 code otherwise.</para>
810 <title>See Also</title>
812 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
813 <citerefentry><refentrytitle>systemadm</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
814 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
815 <citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
816 <citerefentry><refentrytitle>wall</refentrytitle><manvolnum>1</manvolnum></citerefentry>