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