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>--full</option></term>
132 <listitem><para>Do not ellipsize unit
133 names and truncate unit descriptions
135 <command>list-units</command> and
136 <command>list-jobs</command>.</para></listitem>
140 <term><option>--fail</option></term>
142 <listitem><para>If the requested
143 operation conflicts with a pending
144 unfinished job, fail the command. If
145 this is not specified the requested
146 operation will replace the pending job,
147 if necessary.</para></listitem>
151 <term><option>--quiet</option></term>
152 <term><option>-q</option></term>
154 <listitem><para>Suppress output to
156 <command>snapshot</command>,
157 <command>is-active</command>,
158 <command>enable</command> and
159 <command>disable</command>.</para></listitem>
163 <term><option>--no-block</option></term>
165 <listitem><para>Do not synchronously wait for
166 the requested operation to finish. If this is
167 not specified the job will be verified,
168 enqueued and <command>systemctl</command> will
169 wait until it is completed. By passing this
170 argument it is only verified and
171 enqueued.</para></listitem> </varlistentry>
174 <term><option>--system</option></term>
176 <listitem><para>Talk to the systemd
177 system manager. (Default)</para></listitem>
181 <term><option>--user</option></term>
183 <listitem><para>Talk to the systemd
184 manager of the calling user.</para></listitem>
188 <term><option>--order</option></term>
189 <term><option>--require</option></term>
191 <listitem><para>When used in
193 <command>dot</command> command (see
194 below), selects which dependencies are
195 shown in the dependency graph. If
196 <option>--order</option> is passed
197 only dependencies of type
198 <varname>After=</varname> or
199 <varname>Before=</varname> are
200 shown. If <option>--require</option>
201 is passed only dependencies of type
202 <varname>Requires=</varname>,
203 <varname>RequiresOverridable=</varname>,
204 <varname>Requisite=</varname>,
205 <varname>RequisiteOverridable=</varname>,
206 <varname>Wants=</varname> and
207 <varname>Conflicts=</varname> are
208 shown. If neither is passed, shows
209 dependencies of all these
210 types.</para></listitem>
214 <term><option>--no-wall</option></term>
216 <listitem><para>Don't send wall
218 halt, power-off, reboot.</para></listitem>
222 <term><option>--global</option></term>
224 <listitem><para>When used with
225 <command>enable</command> and
226 <command>disable</command>, operate on the
227 global user configuration
228 directory, thus enabling or disabling
229 a unit file globally for all future
230 logins of all users.</para></listitem>
234 <term><option>--no-reload</option></term>
236 <listitem><para>When used with
237 <command>enable</command> and
238 <command>disable</command>, do not
239 implicitly reload daemon configuration
241 changes.</para></listitem>
245 <term><option>--no-ask-password</option></term>
247 <listitem><para>When used with
248 <command>start</command> and related
249 commands, disables asking for
250 passwords. Background services may
251 require input of a password or
252 passphrase string, for example to
253 unlock system hard disks or
254 cryptographic certificates. Unless
255 this option is specified and the
256 command is invoked from a terminal
257 <command>systemctl</command> will
258 query the user on the terminal for the
259 necessary secrets. Use this option to
260 switch this behavior off. In this
261 case the password must be supplied by
262 some other means (for example
263 graphical password agents) or the
264 service might fail.</para></listitem>
268 <term><option>--kill-mode=</option></term>
270 <listitem><para>When used with
271 <command>kill</command>, choose the
272 mode how to kill the selected
273 processes. Must be one of
274 <option>control-group</option>,
275 <option>process-group</option> or
276 <option>process</option> to select
277 whether to kill the entire control
278 group, the process group or only the
279 selected process itself. If omitted
281 <option>control-group</option> if
282 <option>--kill-who=all</option> is
283 set, or <option>process</option>
284 otherwise. You probably never need to
285 use this switch.</para></listitem>
289 <term><option>--kill-who=</option></term>
291 <listitem><para>When used with
292 <command>kill</command>, choose which
293 processes to kill. Must be one of
294 <option>main</option>,
295 <option>control</option> or
296 <option>all</option> to select whether
297 to kill only the main process of the
298 unit, the control process or all
299 processes of the unit. If omitted
301 <option>all</option>.</para></listitem>
305 <term><option>--signal=</option></term>
306 <term><option>-s</option></term>
308 <listitem><para>When used with
309 <command>kill</command>, choose which
310 signal to send to selected
311 processes. Must be one of the well
312 known signal specifiers such as
313 SIGTERM, SIGINT or SIGSTOP. If
315 <option>SIGTERM</option>.</para></listitem>
319 <term><option>--force</option></term>
320 <term><option>-f</option></term>
322 <listitem><para>When used with
323 <command>enable</command>, override any
325 symlinks.</para></listitem>
327 <listitem><para>When used with
328 <command>halt</command>,
329 <command>poweroff</command>,
330 <command>reboot</command> or
331 <command>kexec</command> execute
332 selected operation without shutting
333 down all units. However, all processes
334 will be killed forcibly and all file
335 systems are unmounted or remounted
336 read-only. This is hence a drastic but
337 relatively safe option to request an
338 immediate reboot.</para></listitem>
342 <term><option>--defaults</option></term>
344 <listitem><para>When used with
345 <command>disable</command>, ensures
346 that only the symlinks created by
347 <command>enable</command> are removed,
348 not all symlinks pointing to the unit
350 disabled.</para></listitem>
354 <para>The following commands are understood:</para>
358 <term><command>list-units</command></term>
360 <listitem><para>List known units.</para></listitem>
363 <term><command>start [NAME...]</command></term>
365 <listitem><para>Start (activate) one
366 or more units specified on the command
367 line.</para></listitem>
370 <term><command>stop [NAME...]</command></term>
372 <listitem><para>Stop (deactivate) one
373 or more units specified on the command
374 line.</para></listitem>
377 <term><command>reload [NAME...]</command></term>
379 <listitem><para>Asks all units listed
380 on the command line to reload their
381 configuration. Note that this will
382 reload the service-specific
383 configuration, not the unit
384 configuration file of systemd. If you
385 want systemd to reload the
386 configuration file of a unit use the
387 <command>daemon-reload</command>
388 command. In other words: for the
389 example case of Apache, this will
391 <filename>httpd.conf</filename> in the
393 <filename>apache.service</filename>
394 systemd unit file. </para>
396 <para>This command should not be
398 <command>daemon-reload</command> or
399 <command>load</command>
400 commands.</para></listitem>
404 <term><command>restart [NAME...]</command></term>
406 <listitem><para>Restart one or more
407 units specified on the command
408 line. If the units are not running yet
410 started.</para></listitem>
413 <term><command>try-restart [NAME...]</command></term>
415 <listitem><para>Restart one or more
416 units specified on the command
417 line. If the units are not running yet
419 fail. Note that for compatibility
420 with Red Hat init scripts
421 <command>condrestart</command> is
422 equivalent to this command.</para></listitem>
425 <term><command>reload-or-restart [NAME...]</command></term>
427 <listitem><para>Reload one or more
428 units if they support it. If not,
429 restart them instead. If the units
430 are not running yet they will be
431 started.</para></listitem>
434 <term><command>reload-or-try-restart [NAME...]</command></term>
436 <listitem><para>Reload one or more
437 units if they support it. If not,
438 restart them instead. If the units
439 are not running yet the operation
440 will fail. Note that for
441 compatibility with SysV init scripts
442 <command>force-reload</command> is
443 equivalent to this command.</para></listitem>
446 <term><command>isolate [NAME]</command></term>
448 <listitem><para>Start the unit
449 specified on the command line and its
450 dependencies and stop all others.</para>
452 <para>This is similar to changing the
453 runlevel in a traditional init system. The
454 <command>isolate</command> command will
455 immediately stop processes that are not
456 enabled in the new unit, possibly including
457 the graphical environment or terminal you
458 are currently using.</para>
460 <para>Note that this works only on units
461 where <option>AllowIsolate=</option> is
463 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
464 for details.</para></listitem>
467 <term><command>kill [NAME...]</command></term>
469 <listitem><para>Send a signal to one
470 or more processes of the unit. Use
471 <option>--kill-who=</option> to select
472 which process to kill. Use
473 <option>--kill-mode=</option> to
474 select the kill mode and
475 <option>--signal=</option> to select
476 the signal to send.</para></listitem>
479 <term><command>is-active [NAME...]</command></term>
481 <listitem><para>Check whether any of
482 the specified units are active
483 (i.e. running). Returns an exit code
484 0 if at least one is active, non-zero
486 <option>--quiet</option> is specified
487 this will also print the current unit
488 state to STDOUT.</para></listitem>
491 <term><command>status [NAME...|PID...]</command></term>
493 <listitem><para>Show terse runtime
494 status information about one or more
495 units. This function is intended to
496 generate human-readable output. If you
497 are looking for computer-parsable
498 output, use <command>show</command>
499 instead. If a PID is passed
500 information about the unit the process
501 of the PID belongs to is
502 shown.</para></listitem>
505 <term><command>show [NAME...|JOB...]</command></term>
507 <listitem><para>Show properties of one
508 or more units, jobs or the manager
509 itself. If no argument is specified
510 properties of the manager will be
511 shown. If a unit name is specified
512 properties of the unit is shown, and
513 if a job id is specified properties of
514 the job is shown. By default, empty
515 properties are suppressed. Use
516 <option>--all</option> to show those
517 too. To select specific properties to
519 <option>--property=</option>. This
520 command is intended to be used
521 whenever computer-parsable output is
523 <command>status</command> if you are
524 looking for formatted human-readable
525 output.</para></listitem>
529 <term><command>reset-failed [NAME...]</command></term>
531 <listitem><para>Reset the
532 '<literal>failed</literal>' state of the
533 specified units, or if no unit name is
534 passed of all units. When a unit fails
535 in some way (i.e. process exiting with
536 non-zero error code, terminating
537 abnormally or timing out) it will
538 automatically enter the
539 '<literal>failed</literal>' state and
540 its exit code and status is recorded
541 for introspection by the administrator
542 until the service is restarted or
544 command.</para></listitem>
548 <term><command>enable [NAME...]</command></term>
550 <listitem><para>Enable one or more
551 unit files, as specified on the
552 command line. This will create a
553 number of symlinks as encoded in the
554 <literal>[Install]</literal> sections
555 of the unit files. After the symlinks
556 have been created the systemd
557 configuration is reloaded (in a way
558 that is equivalent to
559 <command>daemon-reload</command>) to
560 ensure the changes are taken into
561 account immediately. Note that this
562 does not have the effect that any of
563 the units enabled are also started at
564 the same time. If this is desired a
565 separate <command>start</command>
566 command must be invoked for the
569 <para>This command will
570 print the actions executed. This
571 output may be suppressed by passing
572 <option>--quiet</option>.</para>
574 <para>Note that this operation creates
575 only the suggested symlinks for the
576 units. While this command is the
577 recommended way to manipulate the unit
578 configuration directory, the
579 administrator is free to make
580 additional changes manually, by
581 placing or removing symlinks in the
582 directory. This is particularly useful
583 to create configurations that deviate
584 from the suggested default
585 installation. In this case the
586 administrator must make sure to invoke
587 <command>daemon-reload</command>
588 manually as necessary, to ensure his
589 changes are taken into account.</para>
591 <para>Enabling units should not be
592 confused with starting (activating)
593 units, as done by the
594 <command>start</command>
595 command. Enabling and starting units
596 is orthogonal: units may be enabled
597 without being started and started
598 without being enabled. Enabling simply
599 hooks the unit into various suggested
600 places (for example, so that the unit
601 is automatically started on boot or
602 when a particular kind of hardware is
603 plugged in). Starting actually spawns
604 the daemon process (in case of service
605 units), or binds the socket (in case
606 of socket units), and so
609 <para>Depending on whether
610 <option>--system</option>,
611 <option>--user</option> or
612 <option>--global</option> is specified
613 this enables the unit for the system,
614 for the calling user only
615 or for all future logins of all
616 users. Note that in the latter case no
617 systemd daemon configuration is
623 <term><command>disable [NAME...]</command></term>
625 <listitem><para>Disables one or more
626 units. This removes all symlinks to
627 the specified unit files from the unit
628 configuration directory, and hence
629 undoes the changes made by
630 <command>enable</command>. Note
631 however that this by default removes
632 all symlinks to the unit files
633 (i.e. including manual additions), not
634 just those actually created by
635 <command>enable</command>. If only the
636 symlinks that are suggested by default
637 shall be removed, pass
638 <option>--defaults</option>. This
639 implicitly reloads the systemd daemon
640 configuration after completing the
641 disabling of the units. Note that this
642 command does not implicitly stop the
643 units that is being disabled. If this
644 is desired an additional
645 <command>stop</command>command should
646 be executed afterwards.</para>
648 <para>This command will print the
649 actions executed. This output may be
650 suppressed by passing
651 <option>--quiet</option>.</para>
654 <para>This command honors
655 <option>--system</option>,
656 <option>--user</option>,
657 <option>--global</option> in a similar
659 <command>enable</command>.</para>
663 <term><command>is-enabled [NAME...]</command></term>
665 <listitem><para>Checks whether any of
666 the specified unit files is enabled
668 <command>enable</command>). Returns an
669 exit code of 0 if at least one is
671 otherwise.</para></listitem>
675 <term><command>load [NAME...]</command></term>
677 <listitem><para>Load one or more units
678 specified on the command line. This
679 will simply load their configuration
680 from disk, but not start them. To
681 start them you need to use the
682 <command>start</command> command which
683 will implicitly load a unit that has
684 not been loaded yet. Note that systemd
685 garbage collects loaded units that are
686 not active or referenced by an active
687 unit. This means that units loaded
688 this way will usually not stay loaded
689 for long. Also note that this command
690 cannot be used to reload unit
691 configuration. Use the
692 <command>daemon-reload</command>
693 command for that. All in all, this
694 command is of little use except for
696 <para>This command should not be
698 <command>daemon-reload</command> or
699 <command>reload</command>
700 commands.</para></listitem>
703 <term><command>list-jobs</command></term>
705 <listitem><para>List jobs that are in progress.</para></listitem>
708 <term><command>cancel [JOB...]</command></term>
710 <listitem><para>Cancel one or more
711 jobs specified on the command line by
713 IDs. If no job id is specified, cancel all pending jobs.</para></listitem>
716 <term><command>monitor</command></term>
718 <listitem><para>Monitor unit/job
719 changes. This is mostly useful for
720 debugging purposes and prints a line
721 each time systemd loads or unloads a
722 unit configuration file, or a unit
723 property changes.</para></listitem>
726 <term><command>dump</command></term>
728 <listitem><para>Dump server
729 status. This will output a (usually
730 very long) human readable manager
731 status dump. Its format is subject to
732 change without notice and should not
734 applications.</para></listitem>
737 <term><command>dot</command></term>
739 <listitem><para>Generate textual
740 dependency graph description in dot
741 format for further processing with the
743 <citerefentry><refentrytitle>dot</refentrytitle><manvolnum>1</manvolnum></citerefentry>
744 tool. Use a command line like
745 <command>systemctl dot | dot -Tsvg >
746 systemd.svg</command> to generate a
747 graphical dependency tree. Unless
748 <option>--order</option> or
749 <option>--require</option> is passed
750 the generated graph will show both
751 ordering and requirement
752 dependencies.</para></listitem>
755 <term><command>snapshot [NAME]</command></term>
757 <listitem><para>Create a snapshot. If
758 a snapshot name is specified, the new
759 snapshot will be named after it. If
760 none is specified an automatic
761 snapshot name is generated. In either
762 case, the snapshot name used is
763 printed to STDOUT, unless
764 <option>--quiet</option> is
767 <para>A snapshot refers to a saved
768 state of the systemd manager. It is
769 implemented itself as a unit that is
770 generated dynamically with this
771 command and has dependencies on all
772 units active at the time. At a later
773 time the user may return to this state
775 <command>isolate</command> command on
776 the snapshot unit.</para></listitem>
778 <para>Snapshots are only useful for
779 saving and restoring which units are
780 running or are stopped, they do not
781 save/restore any other
782 state. Snapshots are dynamic and lost
786 <term><command>delete [NAME...]</command></term>
788 <listitem><para>Remove a snapshot
789 previously created with
790 <command>snapshot</command>.</para></listitem>
793 <term><command>daemon-reload</command></term>
795 <listitem><para>Reload systemd manager
796 configuration. This will reload all
797 unit files and recreate the entire
798 dependency tree. While the daemon is
799 reloaded, all sockets systemd listens
800 on on behalf of user configuration will
801 stay accessible.</para> <para>This
802 command should not be confused with
803 the <command>load</command> or
804 <command>reload</command>
805 commands.</para></listitem>
808 <term><command>daemon-reexec</command></term>
810 <listitem><para>Reexecute the systemd
811 manager. This will serialize the
812 manager state, reexecute the process
813 and deserialize the state again. This
814 command is of little use except for
815 debugging and package
816 upgrades. Sometimes it might be
817 helpful as a heavy-weight
818 <command>daemon-reload</command>. While
819 the daemon is reexecuted all sockets
820 systemd listens on on behalf of user
821 configuration will stay
822 accessible.</para></listitem>
825 <term><command>show-environment</command></term>
827 <listitem><para>Dump the systemd
828 manager environment block. The
829 environment block will be dumped in
830 straight-forward form suitable for
831 sourcing into a shell script. This
832 environment block will be passed to
833 all processes the manager
834 spawns.</para></listitem>
837 <term><command>set-environment [NAME=VALUE...]</command></term>
839 <listitem><para>Set one or more
840 systemd manager environment variables,
841 as specified on the command
842 line.</para></listitem>
845 <term><command>unset-environment [NAME...]</command></term>
847 <listitem><para>Unset one or more
848 systemd manager environment
849 variables. If only a variable name is
850 specified it will be removed
851 regardless of its value. If a variable
852 and a value are specified the variable
853 is only removed if it has the
854 specified value.</para></listitem>
857 <term><command>default</command></term>
859 <listitem><para>Enter default
860 mode. This is mostly equivalent to
862 default.target</command>.</para></listitem>
865 <term><command>rescue</command></term>
867 <listitem><para>Enter rescue
868 mode. This is mostly equivalent to
870 rescue.target</command> but also
871 prints a wall message to all
872 users.</para></listitem>
875 <term><command>emergency</command></term>
877 <listitem><para>Enter emergency
878 mode. This is mostly equivalent to
880 emergency.target</command> but also
881 prints a wall message to all
882 users.</para></listitem>
885 <term><command>halt</command></term>
887 <listitem><para>Shut down and halt the
888 system. This is mostly equivalent to
889 <command>start halt.target</command>
890 but also prints a wall message to all
892 combined with <option>--force</option>
893 shutdown of all running services is
894 skipped, however all processes are killed
895 and all file systems are unmounted or
896 mounted read-only, immediately
898 system halt.</para></listitem>
901 <term><command>poweroff</command></term>
903 <listitem><para>Shut down and
904 power-off the system. This is mostly
905 equivalent to <command>start
906 poweroff.target</command> but also
907 prints a wall message to all
909 combined with <option>--force</option>
910 shutdown of all running services is
911 skipped, however all processes are killed
912 and all file systems are unmounted or
913 mounted read-only, immediately
915 powering off.</para></listitem>
918 <term><command>reboot</command></term>
920 <listitem><para>Shut down and
921 reboot the system. This is mostly
922 equivalent to <command>start
923 reboot.target</command> but also
924 prints a wall message to all
926 combined with <option>--force</option>
927 shutdown of all running services is
928 skipped, however all processes are killed
929 and all file systems are unmounted or
930 mounted read-only, immediately
932 reboot.</para></listitem>
935 <term><command>kexec</command></term>
937 <listitem><para>Shut down and reboot
938 the system via kexec. This is mostly
939 equivalent to <command>start
940 kexec.target</command> but also prints
941 a wall message to all users. If
942 combined with <option>--force</option>
943 shutdown of all running services is
944 skipped, however all processes are killed
945 and all file systems are unmounted or
946 mounted read-only, immediately
948 reboot.</para></listitem>
951 <term><command>exit</command></term>
953 <listitem><para>Ask the systemd
954 manager to quit. This is only
955 supported for user service managers
956 (i.e. in conjunction with the
957 <option>--user</option> option) and
958 will fail otherwise.</para></listitem>
965 <title>Exit status</title>
967 <para>On success 0 is returned, a non-zero failure
968 code otherwise.</para>
972 <title>See Also</title>
974 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
975 <citerefentry><refentrytitle>systemadm</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
976 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
977 <citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
978 <citerefentry><refentrytitle>wall</refentrytitle><manvolnum>1</manvolnum></citerefentry>