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 service 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 service 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>--version</option></term>
82 <listitem><para>Prints a short version
83 string and exits.</para></listitem>
87 <term><option>--type=</option></term>
88 <term><option>-t</option></term>
90 <listitem><para>When listing units,
91 limit display to certain unit
92 types. If not specified units of all
93 types will be shown. The argument
94 should be a unit type name such as
95 <option>service</option>,
96 <option>socket</option> and
97 similar.</para></listitem>
101 <term><option>--property=</option></term>
102 <term><option>-p</option></term>
104 <listitem><para>When showing
105 unit/job/manager information, limit
106 display to certain properties as
107 specified as argument. If not
108 specified all set properties are
109 shown. The argument should be a
110 property name, such as
111 <literal>MainPID</literal>. If
112 specified more than once all
113 properties with the specified names
114 are shown.</para></listitem>
118 <term><option>--all</option></term>
119 <term><option>-a</option></term>
121 <listitem><para>When listing units,
122 show all units, regardless of their
123 state, including inactive units. When
124 showing unit/job/manager information,
125 show all properties regardless whether
126 they are set or not.</para></listitem>
130 <term><option>--failed</option></term>
132 <listitem><para>When listing units,
133 show only failed units. Do not confuse
135 <option>--fail</option>.</para></listitem>
139 <term><option>--full</option></term>
141 <listitem><para>Do not ellipsize unit
142 names and truncate unit descriptions
144 <command>list-units</command> and
145 <command>list-jobs</command>.</para></listitem>
149 <term><option>--fail</option></term>
151 <listitem><para>If the requested
152 operation conflicts with a pending
153 unfinished job, fail the command. If
154 this is not specified the requested
155 operation will replace the pending job,
156 if necessary. Do not confuse
158 <option>--failed</option>.</para></listitem>
162 <term><option>--quiet</option></term>
163 <term><option>-q</option></term>
165 <listitem><para>Suppress output to
167 <command>snapshot</command>,
168 <command>is-active</command>,
169 <command>enable</command> and
170 <command>disable</command>.</para></listitem>
174 <term><option>--no-block</option></term>
176 <listitem><para>Do not synchronously wait for
177 the requested operation to finish. If this is
178 not specified the job will be verified,
179 enqueued and <command>systemctl</command> will
180 wait until it is completed. By passing this
181 argument it is only verified and
182 enqueued.</para></listitem> </varlistentry>
185 <term><option>--no-pager</option></term>
187 <listitem><para>Do not pipe output into a
188 pager.</para></listitem>
192 <term><option>--system</option></term>
194 <listitem><para>Talk to the systemd
195 system manager. (Default)</para></listitem>
199 <term><option>--user</option></term>
201 <listitem><para>Talk to the systemd
202 manager of the calling user.</para></listitem>
206 <term><option>--order</option></term>
207 <term><option>--require</option></term>
209 <listitem><para>When used in
211 <command>dot</command> command (see
212 below), selects which dependencies are
213 shown in the dependency graph. If
214 <option>--order</option> is passed
215 only dependencies of type
216 <varname>After=</varname> or
217 <varname>Before=</varname> are
218 shown. If <option>--require</option>
219 is passed only dependencies of type
220 <varname>Requires=</varname>,
221 <varname>RequiresOverridable=</varname>,
222 <varname>Requisite=</varname>,
223 <varname>RequisiteOverridable=</varname>,
224 <varname>Wants=</varname> and
225 <varname>Conflicts=</varname> are
226 shown. If neither is passed, shows
227 dependencies of all these
228 types.</para></listitem>
232 <term><option>--no-wall</option></term>
234 <listitem><para>Don't send wall
236 halt, power-off, reboot.</para></listitem>
240 <term><option>--global</option></term>
242 <listitem><para>When used with
243 <command>enable</command> and
244 <command>disable</command>, operate on the
245 global user configuration
246 directory, thus enabling or disabling
247 a unit file globally for all future
248 logins of all users.</para></listitem>
252 <term><option>--no-reload</option></term>
254 <listitem><para>When used with
255 <command>enable</command> and
256 <command>disable</command>, do not
257 implicitly reload daemon configuration
259 changes.</para></listitem>
263 <term><option>--no-ask-password</option></term>
265 <listitem><para>When used with
266 <command>start</command> and related
267 commands, disables asking for
268 passwords. Background services may
269 require input of a password or
270 passphrase string, for example to
271 unlock system hard disks or
272 cryptographic certificates. Unless
273 this option is specified and the
274 command is invoked from a terminal
275 <command>systemctl</command> will
276 query the user on the terminal for the
277 necessary secrets. Use this option to
278 switch this behavior off. In this
279 case the password must be supplied by
280 some other means (for example
281 graphical password agents) or the
282 service might fail.</para></listitem>
286 <term><option>--kill-mode=</option></term>
288 <listitem><para>When used with
289 <command>kill</command>, choose the
290 mode how to kill the selected
291 processes. Must be one of
292 <option>control-group</option>,
293 <option>process-group</option> or
294 <option>process</option> to select
295 whether to kill the entire control
296 group, the process group or only the
297 selected process itself. If omitted
299 <option>control-group</option> if
300 <option>--kill-who=all</option> is
301 set, or <option>process</option>
302 otherwise. You probably never need to
303 use this switch.</para></listitem>
307 <term><option>--kill-who=</option></term>
309 <listitem><para>When used with
310 <command>kill</command>, choose which
311 processes to kill. Must be one of
312 <option>main</option>,
313 <option>control</option> or
314 <option>all</option> to select whether
315 to kill only the main process of the
316 unit, the control process or all
317 processes of the unit. If omitted
319 <option>all</option>.</para></listitem>
323 <term><option>--signal=</option></term>
324 <term><option>-s</option></term>
326 <listitem><para>When used with
327 <command>kill</command>, choose which
328 signal to send to selected
329 processes. Must be one of the well
330 known signal specifiers such as
331 SIGTERM, SIGINT or SIGSTOP. If
333 <option>SIGTERM</option>.</para></listitem>
337 <term><option>--force</option></term>
338 <term><option>-f</option></term>
340 <listitem><para>When used with
341 <command>enable</command>, override any
343 symlinks.</para></listitem>
345 <listitem><para>When used with
346 <command>halt</command>,
347 <command>poweroff</command>,
348 <command>reboot</command> or
349 <command>kexec</command> execute
350 selected operation without shutting
351 down all units. However, all processes
352 will be killed forcibly and all file
353 systems are unmounted or remounted
354 read-only. This is hence a drastic but
355 relatively safe option to request an
356 immediate reboot.</para></listitem>
360 <term><option>--defaults</option></term>
362 <listitem><para>When used with
363 <command>disable</command>, ensures
364 that only the symlinks created by
365 <command>enable</command> are removed,
366 not all symlinks pointing to the unit
368 disabled.</para></listitem>
372 <para>The following commands are understood:</para>
376 <term><command>list-units</command></term>
378 <listitem><para>List known units.</para></listitem>
381 <term><command>start [NAME...]</command></term>
383 <listitem><para>Start (activate) one
384 or more units specified on the command
385 line.</para></listitem>
388 <term><command>stop [NAME...]</command></term>
390 <listitem><para>Stop (deactivate) one
391 or more units specified on the command
392 line.</para></listitem>
395 <term><command>reload [NAME...]</command></term>
397 <listitem><para>Asks all units listed
398 on the command line to reload their
399 configuration. Note that this will
400 reload the service-specific
401 configuration, not the unit
402 configuration file of systemd. If you
403 want systemd to reload the
404 configuration file of a unit use the
405 <command>daemon-reload</command>
406 command. In other words: for the
407 example case of Apache, this will
409 <filename>httpd.conf</filename> in the
411 <filename>apache.service</filename>
412 systemd unit file. </para>
414 <para>This command should not be
416 <command>daemon-reload</command> or
417 <command>load</command>
418 commands.</para></listitem>
422 <term><command>restart [NAME...]</command></term>
424 <listitem><para>Restart one or more
425 units specified on the command
426 line. If the units are not running yet
428 started.</para></listitem>
431 <term><command>try-restart [NAME...]</command></term>
433 <listitem><para>Restart one or more
434 units specified on the command
435 line. If the units are not running yet
437 fail. Note that for compatibility
438 with Red Hat init scripts
439 <command>condrestart</command> is
440 equivalent to this command.</para></listitem>
443 <term><command>reload-or-restart [NAME...]</command></term>
445 <listitem><para>Reload one or more
446 units if they support it. If not,
447 restart them instead. If the units
448 are not running yet they will be
449 started.</para></listitem>
452 <term><command>reload-or-try-restart [NAME...]</command></term>
454 <listitem><para>Reload one or more
455 units if they support it. If not,
456 restart them instead. If the units
457 are not running yet the operation
458 will fail. Note that for
459 compatibility with SysV init scripts
460 <command>force-reload</command> is
461 equivalent to this command.</para></listitem>
464 <term><command>isolate [NAME]</command></term>
466 <listitem><para>Start the unit
467 specified on the command line and its
468 dependencies and stop all others.</para>
470 <para>This is similar to changing the
471 runlevel in a traditional init system. The
472 <command>isolate</command> command will
473 immediately stop processes that are not
474 enabled in the new unit, possibly including
475 the graphical environment or terminal you
476 are currently using.</para>
478 <para>Note that this works only on units
479 where <option>AllowIsolate=</option> is
481 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
482 for details.</para></listitem>
485 <term><command>kill [NAME...]</command></term>
487 <listitem><para>Send a signal to one
488 or more processes of the unit. Use
489 <option>--kill-who=</option> to select
490 which process to kill. Use
491 <option>--kill-mode=</option> to
492 select the kill mode and
493 <option>--signal=</option> to select
494 the signal to send.</para></listitem>
497 <term><command>is-active [NAME...]</command></term>
499 <listitem><para>Check whether any of
500 the specified units are active
501 (i.e. running). Returns an exit code
502 0 if at least one is active, non-zero
504 <option>--quiet</option> is specified
505 this will also print the current unit
506 state to STDOUT.</para></listitem>
509 <term><command>status [NAME...|PID...]</command></term>
511 <listitem><para>Show terse runtime
512 status information about one or more
513 units. This function is intended to
514 generate human-readable output. If you
515 are looking for computer-parsable
516 output, use <command>show</command>
517 instead. If a PID is passed
518 information about the unit the process
519 of the PID belongs to is
520 shown.</para></listitem>
523 <term><command>show [NAME...|JOB...]</command></term>
525 <listitem><para>Show properties of one
526 or more units, jobs or the manager
527 itself. If no argument is specified
528 properties of the manager will be
529 shown. If a unit name is specified
530 properties of the unit is shown, and
531 if a job id is specified properties of
532 the job is shown. By default, empty
533 properties are suppressed. Use
534 <option>--all</option> to show those
535 too. To select specific properties to
537 <option>--property=</option>. This
538 command is intended to be used
539 whenever computer-parsable output is
541 <command>status</command> if you are
542 looking for formatted human-readable
543 output.</para></listitem>
547 <term><command>reset-failed [NAME...]</command></term>
549 <listitem><para>Reset the
550 '<literal>failed</literal>' state of the
551 specified units, or if no unit name is
552 passed of all units. When a unit fails
553 in some way (i.e. process exiting with
554 non-zero error code, terminating
555 abnormally or timing out) it will
556 automatically enter the
557 '<literal>failed</literal>' state and
558 its exit code and status is recorded
559 for introspection by the administrator
560 until the service is restarted or
562 command.</para></listitem>
566 <term><command>enable [NAME...]</command></term>
568 <listitem><para>Enable one or more
569 unit files, as specified on the
570 command line. This will create a
571 number of symlinks as encoded in the
572 <literal>[Install]</literal> sections
573 of the unit files. After the symlinks
574 have been created the systemd
575 configuration is reloaded (in a way
576 that is equivalent to
577 <command>daemon-reload</command>) to
578 ensure the changes are taken into
579 account immediately. Note that this
580 does not have the effect that any of
581 the units enabled are also started at
582 the same time. If this is desired a
583 separate <command>start</command>
584 command must be invoked for the
587 <para>This command will
588 print the actions executed. This
589 output may be suppressed by passing
590 <option>--quiet</option>.</para>
592 <para>Note that this operation creates
593 only the suggested symlinks for the
594 units. While this command is the
595 recommended way to manipulate the unit
596 configuration directory, the
597 administrator is free to make
598 additional changes manually, by
599 placing or removing symlinks in the
600 directory. This is particularly useful
601 to create configurations that deviate
602 from the suggested default
603 installation. In this case the
604 administrator must make sure to invoke
605 <command>daemon-reload</command>
606 manually as necessary, to ensure his
607 changes are taken into account.</para>
609 <para>Enabling units should not be
610 confused with starting (activating)
611 units, as done by the
612 <command>start</command>
613 command. Enabling and starting units
614 is orthogonal: units may be enabled
615 without being started and started
616 without being enabled. Enabling simply
617 hooks the unit into various suggested
618 places (for example, so that the unit
619 is automatically started on boot or
620 when a particular kind of hardware is
621 plugged in). Starting actually spawns
622 the daemon process (in case of service
623 units), or binds the socket (in case
624 of socket units), and so
627 <para>Depending on whether
628 <option>--system</option>,
629 <option>--user</option> or
630 <option>--global</option> is specified
631 this enables the unit for the system,
632 for the calling user only
633 or for all future logins of all
634 users. Note that in the latter case no
635 systemd daemon configuration is
641 <term><command>disable [NAME...]</command></term>
643 <listitem><para>Disables one or more
644 units. This removes all symlinks to
645 the specified unit files from the unit
646 configuration directory, and hence
647 undoes the changes made by
648 <command>enable</command>. Note
649 however that this by default removes
650 all symlinks to the unit files
651 (i.e. including manual additions), not
652 just those actually created by
653 <command>enable</command>. If only the
654 symlinks that are suggested by default
655 shall be removed, pass
656 <option>--defaults</option>. This
657 implicitly reloads the systemd daemon
658 configuration after completing the
659 disabling of the units. Note that this
660 command does not implicitly stop the
661 units that is being disabled. If this
662 is desired an additional
663 <command>stop</command>command should
664 be executed afterwards.</para>
666 <para>This command will print the
667 actions executed. This output may be
668 suppressed by passing
669 <option>--quiet</option>.</para>
672 <para>This command honors
673 <option>--system</option>,
674 <option>--user</option>,
675 <option>--global</option> in a similar
677 <command>enable</command>.</para>
681 <term><command>is-enabled [NAME...]</command></term>
683 <listitem><para>Checks whether any of
684 the specified unit files is enabled
686 <command>enable</command>). Returns an
687 exit code of 0 if at least one is
689 otherwise.</para></listitem>
693 <term><command>load [NAME...]</command></term>
695 <listitem><para>Load one or more units
696 specified on the command line. This
697 will simply load their configuration
698 from disk, but not start them. To
699 start them you need to use the
700 <command>start</command> command which
701 will implicitly load a unit that has
702 not been loaded yet. Note that systemd
703 garbage collects loaded units that are
704 not active or referenced by an active
705 unit. This means that units loaded
706 this way will usually not stay loaded
707 for long. Also note that this command
708 cannot be used to reload unit
709 configuration. Use the
710 <command>daemon-reload</command>
711 command for that. All in all, this
712 command is of little use except for
714 <para>This command should not be
716 <command>daemon-reload</command> or
717 <command>reload</command>
718 commands.</para></listitem>
721 <term><command>list-jobs</command></term>
723 <listitem><para>List jobs that are in progress.</para></listitem>
726 <term><command>cancel [JOB...]</command></term>
728 <listitem><para>Cancel one or more
729 jobs specified on the command line by
731 IDs. If no job id is specified, cancel all pending jobs.</para></listitem>
734 <term><command>monitor</command></term>
736 <listitem><para>Monitor unit/job
737 changes. This is mostly useful for
738 debugging purposes and prints a line
739 each time systemd loads or unloads a
740 unit configuration file, or a unit
741 property changes.</para></listitem>
744 <term><command>dump</command></term>
746 <listitem><para>Dump server
747 status. This will output a (usually
748 very long) human readable manager
749 status dump. Its format is subject to
750 change without notice and should not
752 applications.</para></listitem>
755 <term><command>dot</command></term>
757 <listitem><para>Generate textual
758 dependency graph description in dot
759 format for further processing with the
761 <citerefentry><refentrytitle>dot</refentrytitle><manvolnum>1</manvolnum></citerefentry>
762 tool. Use a command line like
763 <command>systemctl dot | dot -Tsvg >
764 systemd.svg</command> to generate a
765 graphical dependency tree. Unless
766 <option>--order</option> or
767 <option>--require</option> is passed
768 the generated graph will show both
769 ordering and requirement
770 dependencies.</para></listitem>
773 <term><command>snapshot [NAME]</command></term>
775 <listitem><para>Create a snapshot. If
776 a snapshot name is specified, the new
777 snapshot will be named after it. If
778 none is specified an automatic
779 snapshot name is generated. In either
780 case, the snapshot name used is
781 printed to STDOUT, unless
782 <option>--quiet</option> is
785 <para>A snapshot refers to a saved
786 state of the systemd manager. It is
787 implemented itself as a unit that is
788 generated dynamically with this
789 command and has dependencies on all
790 units active at the time. At a later
791 time the user may return to this state
793 <command>isolate</command> command on
794 the snapshot unit.</para></listitem>
796 <para>Snapshots are only useful for
797 saving and restoring which units are
798 running or are stopped, they do not
799 save/restore any other
800 state. Snapshots are dynamic and lost
804 <term><command>delete [NAME...]</command></term>
806 <listitem><para>Remove a snapshot
807 previously created with
808 <command>snapshot</command>.</para></listitem>
811 <term><command>daemon-reload</command></term>
813 <listitem><para>Reload systemd manager
814 configuration. This will reload all
815 unit files and recreate the entire
816 dependency tree. While the daemon is
817 reloaded, all sockets systemd listens
818 on on behalf of user configuration will
819 stay accessible.</para> <para>This
820 command should not be confused with
821 the <command>load</command> or
822 <command>reload</command>
823 commands.</para></listitem>
826 <term><command>daemon-reexec</command></term>
828 <listitem><para>Reexecute the systemd
829 manager. This will serialize the
830 manager state, reexecute the process
831 and deserialize the state again. This
832 command is of little use except for
833 debugging and package
834 upgrades. Sometimes it might be
835 helpful as a heavy-weight
836 <command>daemon-reload</command>. While
837 the daemon is reexecuted all sockets
838 systemd listens on on behalf of user
839 configuration will stay
840 accessible.</para></listitem>
843 <term><command>show-environment</command></term>
845 <listitem><para>Dump the systemd
846 manager environment block. The
847 environment block will be dumped in
848 straight-forward form suitable for
849 sourcing into a shell script. This
850 environment block will be passed to
851 all processes the manager
852 spawns.</para></listitem>
855 <term><command>set-environment [NAME=VALUE...]</command></term>
857 <listitem><para>Set one or more
858 systemd manager environment variables,
859 as specified on the command
860 line.</para></listitem>
863 <term><command>unset-environment [NAME...]</command></term>
865 <listitem><para>Unset one or more
866 systemd manager environment
867 variables. If only a variable name is
868 specified it will be removed
869 regardless of its value. If a variable
870 and a value are specified the variable
871 is only removed if it has the
872 specified value.</para></listitem>
875 <term><command>default</command></term>
877 <listitem><para>Enter default
878 mode. This is mostly equivalent to
880 default.target</command>.</para></listitem>
883 <term><command>rescue</command></term>
885 <listitem><para>Enter rescue
886 mode. This is mostly equivalent to
888 rescue.target</command> but also
889 prints a wall message to all
890 users.</para></listitem>
893 <term><command>emergency</command></term>
895 <listitem><para>Enter emergency
896 mode. This is mostly equivalent to
898 emergency.target</command> but also
899 prints a wall message to all
900 users.</para></listitem>
903 <term><command>halt</command></term>
905 <listitem><para>Shut down and halt the
906 system. This is mostly equivalent to
907 <command>start halt.target</command>
908 but also prints a wall message to all
910 combined with <option>--force</option>
911 shutdown of all running services is
912 skipped, however all processes are killed
913 and all file systems are unmounted or
914 mounted read-only, immediately
916 system halt.</para></listitem>
919 <term><command>poweroff</command></term>
921 <listitem><para>Shut down and
922 power-off the system. This is mostly
923 equivalent to <command>start
924 poweroff.target</command> but also
925 prints a wall message to all
927 combined with <option>--force</option>
928 shutdown of all running services is
929 skipped, however all processes are killed
930 and all file systems are unmounted or
931 mounted read-only, immediately
933 powering off.</para></listitem>
936 <term><command>reboot</command></term>
938 <listitem><para>Shut down and
939 reboot the system. This is mostly
940 equivalent to <command>start
941 reboot.target</command> but also
942 prints a wall message to all
944 combined with <option>--force</option>
945 shutdown of all running services is
946 skipped, however all processes are killed
947 and all file systems are unmounted or
948 mounted read-only, immediately
950 reboot.</para></listitem>
953 <term><command>kexec</command></term>
955 <listitem><para>Shut down and reboot
956 the system via kexec. This is mostly
957 equivalent to <command>start
958 kexec.target</command> but also prints
959 a wall message to all users. If
960 combined with <option>--force</option>
961 shutdown of all running services is
962 skipped, however all processes are killed
963 and all file systems are unmounted or
964 mounted read-only, immediately
966 reboot.</para></listitem>
969 <term><command>exit</command></term>
971 <listitem><para>Ask the systemd
972 manager to quit. This is only
973 supported for user service managers
974 (i.e. in conjunction with the
975 <option>--user</option> option) and
976 will fail otherwise.</para></listitem>
983 <title>Exit status</title>
985 <para>On success 0 is returned, a non-zero failure
986 code otherwise.</para>
990 <title>See Also</title>
992 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
993 <citerefentry><refentrytitle>systemadm</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
994 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
995 <citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
996 <citerefentry><refentrytitle>wall</refentrytitle><manvolnum>1</manvolnum></citerefentry>