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>--kill-mode=</option></term>
240 <listitem><para>When used with
241 <command>kill</command>, choose the
242 mode how to kill the selected
243 processes. Must be one of
244 <option>control-group</option>,
245 <option>process-group</option> or
246 <option>process</option> to select
247 whether to kill the entire control
248 group, the process group or only the
249 selected process itself. If ommitted
251 <option>control-group</option> if
252 <option>--kill-who=all</option> is
253 set, or <option>process</option>
254 otherwise. You probably never need to
255 use this switch.</para></listitem>
259 <term><option>--kill-who=</option></term>
261 <listitem><para>When used with
262 <command>kill</command>, choose which
263 processes to kill. Must be one of
264 <option>main</option>,
265 <option>control</option> or
266 <option>all</option> to select whether
267 to kill only the main process of the
268 unit, the control process or all
269 processes of the unit. If ommitted
271 <option>all</option>.</para></listitem>
275 <term><option>---signal=</option></term>
276 <term><option>-s</option></term>
278 <listitem><para>When used with
279 <command>kill</command>, choose which
280 signal to send to selected
281 processes. Must be one of the well
282 know signal specifiers such as
283 SIGTERM, SIGINT or SIGSTOP. If
285 <option>SIGTERM</option>.</para></listitem>
289 <term><option>--force</option></term>
291 <listitem><para>When used with
292 <command>enable</command>, override any
294 symlinks.</para></listitem>
298 <term><option>--defaults</option></term>
300 <listitem><para>When used with
301 <command>disable</command>, ensures
302 that only the symlinks created by
303 <command>enable</command> are removed,
304 not all symlinks pointing to the unit
306 disabled.</para></listitem>
310 <para>The following commands are understood:</para>
314 <term><command>list-units</command></term>
316 <listitem><para>List known units.</para></listitem>
319 <term><command>start [NAME...]</command></term>
321 <listitem><para>Start (activate) one
322 or more units specified on the command
323 line.</para></listitem>
326 <term><command>stop [NAME...]</command></term>
328 <listitem><para>Stop (deactivate) one
329 or more units specified on the command
330 line.</para></listitem>
333 <term><command>reload [NAME...]</command></term>
335 <listitem><para>Asks all units listed
336 on the command line to reload their
337 configuration. Note that this will
338 reload the service-specific
339 configuration, not the unit
340 configuration file of systemd. If you
341 want systemd to reload the
342 configuration file of a unit use the
343 <command>daemon-reload</command>
344 command. In other words: for the
345 example case of Apache, this will
347 <filename>httpd.conf</filename> in the
349 <filename>apache.service</filename>
350 systemd unit file. </para>
352 <para>This command should not be
354 <command>daemon-reload</command> or
355 <command>load</command>
356 commands.</para></listitem>
360 <term><command>restart [NAME...]</command></term>
362 <listitem><para>Restart one or more
363 units specified on the command
364 line. If the units are not running yet
366 started.</para></listitem>
369 <term><command>try-restart [NAME...]</command></term>
371 <listitem><para>Restart one or more
372 units specified on the command
373 line. If the units are not running yet
375 fail.</para></listitem>
378 <term><command>reload-or-restart [NAME...]</command></term>
379 <term><command>reload-or-try-restart [NAME...]</command></term>
381 <listitem><para>Reload one or more
382 units if they support it. If not,
383 restart them instead. Note that for
384 compatibility with SysV and Red Hat
386 <command>force-reload</command> and
387 <command>condrestart</command> may be
388 used as equivalent commands to
389 <command>reload-or-try-restart</command>.</para></listitem>
392 <term><command>isolate [NAME]</command></term>
394 <listitem><para>Start the unit
395 specified on the command line and its
396 dependencies and stop all others.</para>
398 <para>This is similar to changing the
399 runlevel in a traditional init system. The
400 <command>isolate</command> command will
401 immediately stop processes that are not
402 enabled in the new unit, possibly including
403 the graphical environment or terminal you
404 are currently using.</para>
406 <para>Note that this works only on units
407 where <option>AllowIsolate=</option> is
409 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
410 for details.</para></listitem>
413 <term><command>kill [NAME...]</command></term>
415 <listitem><para>Send a signal to one
416 or more processes of the unit. Use
417 <option>--kill-who=</option> to select
418 which process to kill. Use
419 <option>--kill-mode=</option> to
420 select the kill mode and
421 <option>--signal=</option> to select
422 the signal to send.</para></listitem>
425 <term><command>is-active [NAME...]</command></term>
427 <listitem><para>Check whether any of
428 the specified units is active
429 (i.e. running). Returns an exit code
430 0 if at least one is active, non-zero
432 <option>--quiet</option> is specified
433 this will also print the current unit
434 state to STDOUT.</para></listitem>
437 <term><command>status [NAME...|PID...]</command></term>
439 <listitem><para>Show terse runtime
440 status information about one or more
441 units. This function is intended to
442 generate human-readable output. If you
443 are looking for computer-parsable
444 output, use <command>show</command>
445 instead. If a PID is passed
446 information about the unit the process
447 of the PID belongs to is
448 shown.</para></listitem>
451 <term><command>show [NAME...|JOB...]</command></term>
453 <listitem><para>Show properties of one
454 or more units, jobs or the manager
455 itself. If no argument is specified
456 properties of the manager will be
457 shown. If a unit name is specified
458 properties of the unit is shown, and
459 if a job id is specified properties of
460 the job is shown. By default, empty
461 properties are suppressed. Use
462 <option>--all</option> to show those
463 too. To select specific properties to
465 <option>--property=</option>. This
466 command is intended to be used
467 whenever computer-parsable output is
469 <command>status</command> if you are
470 looking for formatted human-readable
471 output.</para></listitem>
475 <term><command>reset-failed [NAME...]</command></term>
477 <listitem><para>Reset the
478 '<literal>failed</literal>' state of the
479 specified units, or if no unit name is
480 passed of all units. When a unit fails
481 in some way (i.e. process exiting with
482 non-zero error code, terminating
483 abnormally or timing out) it will
484 automatically enter the
485 '<literal>failed</literal>' state and
486 its exit code and status is recorded
487 for introspection by the administrator
488 until the service is restarted or
490 command.</para></listitem>
494 <term><command>enable [NAME...]</command></term>
496 <listitem><para>Enable one or more
497 unit files, as specified on the
498 command line. This will create a
499 number of symlinks as encoded in the
500 <literal>[Install]</literal> sections
501 of the unit files. After the symlinks
502 have been created the systemd
503 configuration is reloaded (in a way
504 that is equivalent to
505 <command>daemon-reload</command>) to
506 ensure the changes are taken into
507 account immediately. Note that this
508 does not have the effect that any of
509 the units enabled are also started at
510 the same time. If this is desired a
511 separate <command>start</command>
512 command must be invoked for the
515 <para>This command will
516 print the actions executed. This
517 output may be suppressed by passing
518 <option>--quiet</option>.</para>
520 <para>Note that this operation creates
521 only the suggested symlinks for the
522 units. While this command is the
523 recommended way to manipulate the unit
524 configuration directory, the
525 administrator is free to make
526 additional changes manually, by
527 placing or removing symlinks in the
528 directory. This is particular useful
529 to create configurations that deviate
530 from the suggested default
531 installation. In this case the
532 administrator must make sure to invoke
533 <command>daemon-reload</command>
534 manually as necessary, to ensure his
535 changes are taken into account.</para>
537 <para>Enabling units should not be
538 confused with starting (activating)
539 units, as done by the
540 <command>start</command>
541 command. Enabling and starting units
542 is orthogonal: units may be enabled
543 without being started and started
544 without being enabled. Enabling simply
545 hooks the unit into various suggested
546 places (for example, so that the unit
547 is automatically started on boot or
548 when a particular kind of hardware is
549 plugged in). Starting actually spawns
550 the daemon process (in case of service
551 units), or binds the socket (in case
552 of socket units), and so
555 <para>Depending on whether
556 <option>--system</option>,
557 <option>--session</option> or
558 <option>--global</option> is specified
559 this enables the unit for the system,
560 for sessions of the calling user only
561 or for all future session of all
562 users. Note that in the latter case no
563 systemd daemon configuration is
569 <term><command>disable [NAME...]</command></term>
571 <listitem><para>Disables one or more
572 units. This removes all symlinks to
573 the specified unit files from the unit
574 configuration directory, and hence
575 undoes the changes made by
576 <command>enable</command>. Note
577 however that this by default removes
578 all symlinks to the unit files
579 (i.e. including manual additions), not
580 just those actually created by
581 <command>enable</command>. If only the
582 symlinks that are suggested by default
583 shall be removed, pass
584 <option>--defaults</option>. This
585 implicitly reloads the systemd daemon
586 configuration after completing the
587 disabling of the units. Note that this
588 command does not implicitly stop the
589 units that is being disabled. If this
590 is desired an additional
591 <command>stop</command>command should
592 be executed afterwards.</para>
594 <para>This command will print the
595 actions executed. This output may be
596 suppressed by passing
597 <option>--quiet</option>.</para>
600 <para>This command honours
601 <option>--system</option>,
602 <option>--session</option>,
603 <option>--global</option> in a similar
605 <command>enable</command>.</para>
609 <term><command>is-enabled [NAME...]</command></term>
611 <listitem><para>Checks whether any of
612 the specified unit files is enabled
614 <command>enable</command>). Returns an
615 exit code of 0 if at least one is
617 otherwise.</para></listitem>
621 <term><command>load [NAME...]</command></term>
623 <listitem><para>Load one or more units
624 specified on the command line. This
625 will simply load their configuration
626 from disk, but not start them. To
627 start them you need to use the
628 <command>start</command> command which
629 will implicitly load a unit that has
630 not been loaded yet. Note that systemd
631 garbage collects loaded units that are
632 not active or referenced by an active
633 unit. This means that units loaded
634 this way will usually not stay loaded
635 for long. Also note that this command
636 cannot be used to reload unit
637 configuration. Use the
638 <command>daemon-reload</command>
639 command for that. All in all, this
640 command is of little use except for
642 <para>This command should not be
644 <command>daemon-reload</command> or
645 <command>reload</command>
646 commands.</para></listitem>
649 <term><command>list-jobs</command></term>
651 <listitem><para>List jobs that are in progress.</para></listitem>
654 <term><command>cancel [JOB...]</command></term>
656 <listitem><para>Cancel one or more
657 jobs specified on the command line by
659 IDs. If not job id is specified cancels all jobs that are pending.</para></listitem>
662 <term><command>monitor</command></term>
664 <listitem><para>Monitor unit/job
665 changes. This is mostly useful for
666 debugging purposes and prints a line
667 each time systemd loads or unloads a
668 unit configuration file, or a unit
669 property changes.</para></listitem>
672 <term><command>dump</command></term>
674 <listitem><para>Dump server
675 status. This will output a (usually
676 very long) human readable manager
677 status dump. Its format is subject to
678 change without notice and should not
680 applications.</para></listitem>
683 <term><command>dot</command></term>
685 <listitem><para>Generate textual
686 dependency graph description in dot
687 format for further processing with the
689 <citerefentry><refentrytitle>dot</refentrytitle><manvolnum>1</manvolnum></citerefentry>
690 tool. Use a command line like
691 <command>systemctl dot | dot -Tsvg >
692 systemd.svg</command> to generate a
693 graphical dependency tree. Unless
694 <option>--order</option> or
695 <option>--require</option> is passed
696 the generated graph will show both
697 ordering and requirement
698 dependencies.</para></listitem>
701 <term><command>snapshot [NAME]</command></term>
703 <listitem><para>Create a snapshot. If
704 a snapshot name is specified, the new
705 snapshot will be named after it. If
706 none is specified an automatic
707 snapshot name is generated. In either
708 case, the snapshot name used is
709 printed to STDOUT, unless
710 <option>--quiet</option> is
713 <para>A snapshot refers to a saved
714 state of the systemd manager. It is
715 implemented itself as unit that is
716 generated dynamically with this
717 command and has dependencies on all
718 units active at the time. At a later
719 time the user may return to this state
721 <command>isolate</command> command on
722 the snapshot unit.</para></listitem>
724 <para>Snapshots are only useful for
725 saving and restoring which units are
726 running or are stopped, they do not
727 save/restore any other
728 state. Snapshots are dynamic and lost
732 <term><command>delete [NAME...]</command></term>
734 <listitem><para>Remove a snapshot
735 previously created with
736 <command>snapshot</command>.</para></listitem>
739 <term><command>daemon-reload</command></term>
741 <listitem><para>Reload systemd manager
742 configuration. This will reload all
743 unit files and recreate the entire
744 dependency tree. While the daemon is
745 reloaded, all sockets systemd listens
746 on on behalf of user configuration will
747 stay accessible.</para> <para>This
748 command should not be confused with
749 the <command>load</command> or
750 <command>reload</command>
751 commands.</para></listitem>
754 <term><command>daemon-reexec</command></term>
756 <listitem><para>Reexecute the systemd
757 manager. This will serialize the
758 manager state, reexecute the process
759 and deserialize the state again. This
760 command is of little use except for
761 debugging and package
762 upgrades. Sometimes it might be
763 helpful as a heavy-weight
764 <command>daemon-reload</command>. While
765 the daemon is reexecuted all sockets
766 systemd listens on on behalf of user
767 configuration will stay
768 accessible.</para></listitem>
771 <term><command>daemon-exit</command></term>
773 <listitem><para>Ask the systemd
774 manager to quit. This is only
775 supported for session managers
776 (i.e. in conjunction with the
777 <option>--session</option> option) and
778 will fail otherwise.</para></listitem>
781 <term><command>show-environment</command></term>
783 <listitem><para>Dump the systemd
784 manager environment block. The
785 environment block will be dumped in
786 straight-forward form suitable for
787 sourcing into a shell script. This
788 environment block will be passed to
789 all processes the manager
790 spawns.</para></listitem>
793 <term><command>set-environment [NAME=VALUE...]</command></term>
795 <listitem><para>Set one or more
796 systemd manager environment variables,
797 as specified on the command
798 line.</para></listitem>
801 <term><command>unset-environment [NAME...]</command></term>
803 <listitem><para>Unset one or more
804 systemd manager environment
805 variables. If only a variable name is
806 specified it will be removed
807 regardless of its value. If a variable
808 and a value are specified the variable
809 is only removed if it has the
810 specified value.</para></listitem>
814 <term><command>halt</command></term>
816 <listitem><para>Shut down and halt the
817 system. This is mostly equivalent to
818 <command>start halt.target</command>
819 but also prints a wall message to all
820 users.</para></listitem>
823 <term><command>poweroff</command></term>
825 <listitem><para>Shut down and
826 power-off the system. This is mostly
827 equivalent to <command>start
828 poweroff.target</command> but also
829 prints a wall message to all
830 users.</para></listitem>
833 <term><command>reboot</command></term>
835 <listitem><para>Shut down and
836 reboot the system. This is mostly
837 equivalent to <command>start
838 reboot.target</command> but also
839 prints a wall message to all
840 users.</para></listitem>
843 <term><command>default</command></term>
845 <listitem><para>Enter default
846 mode. This is mostly equivalent to
848 default.target</command>.</para></listitem>
851 <term><command>rescue</command></term>
853 <listitem><para>Enter rescue
854 mode. This is mostly equivalent to
856 rescue.target</command> but also
857 prints a wall message to all
858 users.</para></listitem>
861 <term><command>emergency</command></term>
863 <listitem><para>Enter emergency
864 mode. This is mostly equivalent to
866 emergency.target</command> but also
867 prints a wall message to all
868 users.</para></listitem>
875 <title>Exit status</title>
877 <para>On success 0 is returned, a non-zero failure
878 code otherwise.</para>
882 <title>See Also</title>
884 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
885 <citerefentry><refentrytitle>systemadm</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
886 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
887 <citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
888 <citerefentry><refentrytitle>wall</refentrytitle><manvolnum>1</manvolnum></citerefentry>