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>
290 <term><option>-f</option></term>
292 <listitem><para>When used with
293 <command>enable</command>, override any
295 symlinks.</para></listitem>
297 <listitem><para>When used with
298 <command>halt</command>,
299 <command>poweroff</command>,
300 <command>reboot</command> or
301 <command>kexec</command> execute
302 selected operation without shutting
303 down all units. However, all processes
304 will be killed forcibly and all file
305 systems are unmounted or remounted
306 read-only. This is hence a drastic but
307 relatively safe option to request an
308 immediate reboot.</para></listitem>
312 <term><option>--defaults</option></term>
314 <listitem><para>When used with
315 <command>disable</command>, ensures
316 that only the symlinks created by
317 <command>enable</command> are removed,
318 not all symlinks pointing to the unit
320 disabled.</para></listitem>
324 <para>The following commands are understood:</para>
328 <term><command>list-units</command></term>
330 <listitem><para>List known units.</para></listitem>
333 <term><command>start [NAME...]</command></term>
335 <listitem><para>Start (activate) one
336 or more units specified on the command
337 line.</para></listitem>
340 <term><command>stop [NAME...]</command></term>
342 <listitem><para>Stop (deactivate) one
343 or more units specified on the command
344 line.</para></listitem>
347 <term><command>reload [NAME...]</command></term>
349 <listitem><para>Asks all units listed
350 on the command line to reload their
351 configuration. Note that this will
352 reload the service-specific
353 configuration, not the unit
354 configuration file of systemd. If you
355 want systemd to reload the
356 configuration file of a unit use the
357 <command>daemon-reload</command>
358 command. In other words: for the
359 example case of Apache, this will
361 <filename>httpd.conf</filename> in the
363 <filename>apache.service</filename>
364 systemd unit file. </para>
366 <para>This command should not be
368 <command>daemon-reload</command> or
369 <command>load</command>
370 commands.</para></listitem>
374 <term><command>restart [NAME...]</command></term>
376 <listitem><para>Restart one or more
377 units specified on the command
378 line. If the units are not running yet
380 started.</para></listitem>
383 <term><command>try-restart [NAME...]</command></term>
385 <listitem><para>Restart one or more
386 units specified on the command
387 line. If the units are not running yet
389 fail.</para></listitem>
392 <term><command>reload-or-restart [NAME...]</command></term>
393 <term><command>reload-or-try-restart [NAME...]</command></term>
395 <listitem><para>Reload one or more
396 units if they support it. If not,
397 restart them instead. Note that for
398 compatibility with SysV and Red Hat
400 <command>force-reload</command> and
401 <command>condrestart</command> may be
402 used as equivalent commands to
403 <command>reload-or-try-restart</command>.</para></listitem>
406 <term><command>isolate [NAME]</command></term>
408 <listitem><para>Start the unit
409 specified on the command line and its
410 dependencies and stop all others.</para>
412 <para>This is similar to changing the
413 runlevel in a traditional init system. The
414 <command>isolate</command> command will
415 immediately stop processes that are not
416 enabled in the new unit, possibly including
417 the graphical environment or terminal you
418 are currently using.</para>
420 <para>Note that this works only on units
421 where <option>AllowIsolate=</option> is
423 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
424 for details.</para></listitem>
427 <term><command>kill [NAME...]</command></term>
429 <listitem><para>Send a signal to one
430 or more processes of the unit. Use
431 <option>--kill-who=</option> to select
432 which process to kill. Use
433 <option>--kill-mode=</option> to
434 select the kill mode and
435 <option>--signal=</option> to select
436 the signal to send.</para></listitem>
439 <term><command>is-active [NAME...]</command></term>
441 <listitem><para>Check whether any of
442 the specified units is active
443 (i.e. running). Returns an exit code
444 0 if at least one is active, non-zero
446 <option>--quiet</option> is specified
447 this will also print the current unit
448 state to STDOUT.</para></listitem>
451 <term><command>status [NAME...|PID...]</command></term>
453 <listitem><para>Show terse runtime
454 status information about one or more
455 units. This function is intended to
456 generate human-readable output. If you
457 are looking for computer-parsable
458 output, use <command>show</command>
459 instead. If a PID is passed
460 information about the unit the process
461 of the PID belongs to is
462 shown.</para></listitem>
465 <term><command>show [NAME...|JOB...]</command></term>
467 <listitem><para>Show properties of one
468 or more units, jobs or the manager
469 itself. If no argument is specified
470 properties of the manager will be
471 shown. If a unit name is specified
472 properties of the unit is shown, and
473 if a job id is specified properties of
474 the job is shown. By default, empty
475 properties are suppressed. Use
476 <option>--all</option> to show those
477 too. To select specific properties to
479 <option>--property=</option>. This
480 command is intended to be used
481 whenever computer-parsable output is
483 <command>status</command> if you are
484 looking for formatted human-readable
485 output.</para></listitem>
489 <term><command>reset-failed [NAME...]</command></term>
491 <listitem><para>Reset the
492 '<literal>failed</literal>' state of the
493 specified units, or if no unit name is
494 passed of all units. When a unit fails
495 in some way (i.e. process exiting with
496 non-zero error code, terminating
497 abnormally or timing out) it will
498 automatically enter the
499 '<literal>failed</literal>' state and
500 its exit code and status is recorded
501 for introspection by the administrator
502 until the service is restarted or
504 command.</para></listitem>
508 <term><command>enable [NAME...]</command></term>
510 <listitem><para>Enable one or more
511 unit files, as specified on the
512 command line. This will create a
513 number of symlinks as encoded in the
514 <literal>[Install]</literal> sections
515 of the unit files. After the symlinks
516 have been created the systemd
517 configuration is reloaded (in a way
518 that is equivalent to
519 <command>daemon-reload</command>) to
520 ensure the changes are taken into
521 account immediately. Note that this
522 does not have the effect that any of
523 the units enabled are also started at
524 the same time. If this is desired a
525 separate <command>start</command>
526 command must be invoked for the
529 <para>This command will
530 print the actions executed. This
531 output may be suppressed by passing
532 <option>--quiet</option>.</para>
534 <para>Note that this operation creates
535 only the suggested symlinks for the
536 units. While this command is the
537 recommended way to manipulate the unit
538 configuration directory, the
539 administrator is free to make
540 additional changes manually, by
541 placing or removing symlinks in the
542 directory. This is particular useful
543 to create configurations that deviate
544 from the suggested default
545 installation. In this case the
546 administrator must make sure to invoke
547 <command>daemon-reload</command>
548 manually as necessary, to ensure his
549 changes are taken into account.</para>
551 <para>Enabling units should not be
552 confused with starting (activating)
553 units, as done by the
554 <command>start</command>
555 command. Enabling and starting units
556 is orthogonal: units may be enabled
557 without being started and started
558 without being enabled. Enabling simply
559 hooks the unit into various suggested
560 places (for example, so that the unit
561 is automatically started on boot or
562 when a particular kind of hardware is
563 plugged in). Starting actually spawns
564 the daemon process (in case of service
565 units), or binds the socket (in case
566 of socket units), and so
569 <para>Depending on whether
570 <option>--system</option>,
571 <option>--session</option> or
572 <option>--global</option> is specified
573 this enables the unit for the system,
574 for sessions of the calling user only
575 or for all future session of all
576 users. Note that in the latter case no
577 systemd daemon configuration is
583 <term><command>disable [NAME...]</command></term>
585 <listitem><para>Disables one or more
586 units. This removes all symlinks to
587 the specified unit files from the unit
588 configuration directory, and hence
589 undoes the changes made by
590 <command>enable</command>. Note
591 however that this by default removes
592 all symlinks to the unit files
593 (i.e. including manual additions), not
594 just those actually created by
595 <command>enable</command>. If only the
596 symlinks that are suggested by default
597 shall be removed, pass
598 <option>--defaults</option>. This
599 implicitly reloads the systemd daemon
600 configuration after completing the
601 disabling of the units. Note that this
602 command does not implicitly stop the
603 units that is being disabled. If this
604 is desired an additional
605 <command>stop</command>command should
606 be executed afterwards.</para>
608 <para>This command will print the
609 actions executed. This output may be
610 suppressed by passing
611 <option>--quiet</option>.</para>
614 <para>This command honours
615 <option>--system</option>,
616 <option>--session</option>,
617 <option>--global</option> in a similar
619 <command>enable</command>.</para>
623 <term><command>is-enabled [NAME...]</command></term>
625 <listitem><para>Checks whether any of
626 the specified unit files is enabled
628 <command>enable</command>). Returns an
629 exit code of 0 if at least one is
631 otherwise.</para></listitem>
635 <term><command>load [NAME...]</command></term>
637 <listitem><para>Load one or more units
638 specified on the command line. This
639 will simply load their configuration
640 from disk, but not start them. To
641 start them you need to use the
642 <command>start</command> command which
643 will implicitly load a unit that has
644 not been loaded yet. Note that systemd
645 garbage collects loaded units that are
646 not active or referenced by an active
647 unit. This means that units loaded
648 this way will usually not stay loaded
649 for long. Also note that this command
650 cannot be used to reload unit
651 configuration. Use the
652 <command>daemon-reload</command>
653 command for that. All in all, this
654 command is of little use except for
656 <para>This command should not be
658 <command>daemon-reload</command> or
659 <command>reload</command>
660 commands.</para></listitem>
663 <term><command>list-jobs</command></term>
665 <listitem><para>List jobs that are in progress.</para></listitem>
668 <term><command>cancel [JOB...]</command></term>
670 <listitem><para>Cancel one or more
671 jobs specified on the command line by
673 IDs. If not job id is specified cancels all jobs that are pending.</para></listitem>
676 <term><command>monitor</command></term>
678 <listitem><para>Monitor unit/job
679 changes. This is mostly useful for
680 debugging purposes and prints a line
681 each time systemd loads or unloads a
682 unit configuration file, or a unit
683 property changes.</para></listitem>
686 <term><command>dump</command></term>
688 <listitem><para>Dump server
689 status. This will output a (usually
690 very long) human readable manager
691 status dump. Its format is subject to
692 change without notice and should not
694 applications.</para></listitem>
697 <term><command>dot</command></term>
699 <listitem><para>Generate textual
700 dependency graph description in dot
701 format for further processing with the
703 <citerefentry><refentrytitle>dot</refentrytitle><manvolnum>1</manvolnum></citerefentry>
704 tool. Use a command line like
705 <command>systemctl dot | dot -Tsvg >
706 systemd.svg</command> to generate a
707 graphical dependency tree. Unless
708 <option>--order</option> or
709 <option>--require</option> is passed
710 the generated graph will show both
711 ordering and requirement
712 dependencies.</para></listitem>
715 <term><command>snapshot [NAME]</command></term>
717 <listitem><para>Create a snapshot. If
718 a snapshot name is specified, the new
719 snapshot will be named after it. If
720 none is specified an automatic
721 snapshot name is generated. In either
722 case, the snapshot name used is
723 printed to STDOUT, unless
724 <option>--quiet</option> is
727 <para>A snapshot refers to a saved
728 state of the systemd manager. It is
729 implemented itself as unit that is
730 generated dynamically with this
731 command and has dependencies on all
732 units active at the time. At a later
733 time the user may return to this state
735 <command>isolate</command> command on
736 the snapshot unit.</para></listitem>
738 <para>Snapshots are only useful for
739 saving and restoring which units are
740 running or are stopped, they do not
741 save/restore any other
742 state. Snapshots are dynamic and lost
746 <term><command>delete [NAME...]</command></term>
748 <listitem><para>Remove a snapshot
749 previously created with
750 <command>snapshot</command>.</para></listitem>
753 <term><command>daemon-reload</command></term>
755 <listitem><para>Reload systemd manager
756 configuration. This will reload all
757 unit files and recreate the entire
758 dependency tree. While the daemon is
759 reloaded, all sockets systemd listens
760 on on behalf of user configuration will
761 stay accessible.</para> <para>This
762 command should not be confused with
763 the <command>load</command> or
764 <command>reload</command>
765 commands.</para></listitem>
768 <term><command>daemon-reexec</command></term>
770 <listitem><para>Reexecute the systemd
771 manager. This will serialize the
772 manager state, reexecute the process
773 and deserialize the state again. This
774 command is of little use except for
775 debugging and package
776 upgrades. Sometimes it might be
777 helpful as a heavy-weight
778 <command>daemon-reload</command>. While
779 the daemon is reexecuted all sockets
780 systemd listens on on behalf of user
781 configuration will stay
782 accessible.</para></listitem>
785 <term><command>daemon-exit</command></term>
787 <listitem><para>Ask the systemd
788 manager to quit. This is only
789 supported for session managers
790 (i.e. in conjunction with the
791 <option>--session</option> option) and
792 will fail otherwise.</para></listitem>
795 <term><command>show-environment</command></term>
797 <listitem><para>Dump the systemd
798 manager environment block. The
799 environment block will be dumped in
800 straight-forward form suitable for
801 sourcing into a shell script. This
802 environment block will be passed to
803 all processes the manager
804 spawns.</para></listitem>
807 <term><command>set-environment [NAME=VALUE...]</command></term>
809 <listitem><para>Set one or more
810 systemd manager environment variables,
811 as specified on the command
812 line.</para></listitem>
815 <term><command>unset-environment [NAME...]</command></term>
817 <listitem><para>Unset one or more
818 systemd manager environment
819 variables. If only a variable name is
820 specified it will be removed
821 regardless of its value. If a variable
822 and a value are specified the variable
823 is only removed if it has the
824 specified value.</para></listitem>
828 <term><command>halt</command></term>
830 <listitem><para>Shut down and halt the
831 system. This is mostly equivalent to
832 <command>start halt.target</command>
833 but also prints a wall message to all
834 users.</para></listitem>
837 <term><command>poweroff</command></term>
839 <listitem><para>Shut down and
840 power-off the system. This is mostly
841 equivalent to <command>start
842 poweroff.target</command> but also
843 prints a wall message to all
844 users.</para></listitem>
847 <term><command>reboot</command></term>
849 <listitem><para>Shut down and
850 reboot the system. This is mostly
851 equivalent to <command>start
852 reboot.target</command> but also
853 prints a wall message to all
854 users.</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>
889 <title>Exit status</title>
891 <para>On success 0 is returned, a non-zero failure
892 code otherwise.</para>
896 <title>See Also</title>
898 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
899 <citerefentry><refentrytitle>systemadm</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
900 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
901 <citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
902 <citerefentry><refentrytitle>wall</refentrytitle><manvolnum>1</manvolnum></citerefentry>