]>
Commit | Line | Data |
---|---|---|
3802a3d3 | 1 | <?xml version='1.0'?> <!--*- Mode: nxml; nxml-child-indent: 2; indent-tabs-mode: nil -*--> |
7874bcd6 | 2 | <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" |
681eb9cf FB |
3 | "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [ |
4 | <!ENTITY % entities SYSTEM "custom-entities.ent" > | |
5 | %entities; | |
6 | ]> | |
7874bcd6 LP |
7 | |
8 | <!-- | |
572eb058 ZJS |
9 | SPDX-License-Identifier: LGPL-2.1+ |
10 | ||
b975b0d5 | 11 | This file is part of systemd. |
7874bcd6 | 12 | |
b975b0d5 | 13 | Copyright 2010 Lennart Poettering |
7874bcd6 | 14 | |
b975b0d5 ZJS |
15 | systemd is free software; you can redistribute it and/or modify it |
16 | under the terms of the GNU Lesser General Public License as published by | |
17 | the Free Software Foundation; either version 2.1 of the License, or | |
18 | (at your option) any later version. | |
7874bcd6 | 19 | |
b975b0d5 ZJS |
20 | systemd is distributed in the hope that it will be useful, but |
21 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
22 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
23 | Lesser General Public License for more details. | |
7874bcd6 | 24 | |
b975b0d5 ZJS |
25 | You should have received a copy of the GNU Lesser General Public License |
26 | along with systemd; If not, see <http://www.gnu.org/licenses/>. | |
7874bcd6 LP |
27 | --> |
28 | ||
21ac6ff1 ZJS |
29 | <refentry id="systemctl" |
30 | xmlns:xi="http://www.w3.org/2001/XInclude"> | |
7874bcd6 | 31 | |
4a6022f0 ZJS |
32 | <refentryinfo> |
33 | <title>systemctl</title> | |
34 | <productname>systemd</productname> | |
35 | ||
36 | <authorgroup> | |
37 | <author> | |
38 | <contrib>Developer</contrib> | |
39 | <firstname>Lennart</firstname> | |
40 | <surname>Poettering</surname> | |
41 | <email>lennart@poettering.net</email> | |
42 | </author> | |
43 | </authorgroup> | |
44 | </refentryinfo> | |
45 | ||
46 | <refmeta> | |
47 | <refentrytitle>systemctl</refentrytitle> | |
48 | <manvolnum>1</manvolnum> | |
49 | </refmeta> | |
50 | ||
51 | <refnamediv> | |
52 | <refname>systemctl</refname> | |
53 | <refpurpose>Control the systemd system and service manager</refpurpose> | |
54 | </refnamediv> | |
55 | ||
56 | <refsynopsisdiv> | |
57 | <cmdsynopsis> | |
58 | <command>systemctl</command> | |
59 | <arg choice="opt" rep="repeat">OPTIONS</arg> | |
60 | <arg choice="plain">COMMAND</arg> | |
61 | <arg choice="opt" rep="repeat">NAME</arg> | |
62 | </cmdsynopsis> | |
63 | </refsynopsisdiv> | |
64 | ||
65 | <refsect1> | |
66 | <title>Description</title> | |
67 | ||
a4390b6b LP |
68 | <para><command>systemctl</command> may be used to introspect and |
69 | control the state of the <literal>systemd</literal> system and | |
70 | service manager. Please refer to | |
4a6022f0 | 71 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry> |
a4390b6b LP |
72 | for an introduction into the basic concepts and functionality this |
73 | tool manages.</para> | |
4a6022f0 ZJS |
74 | </refsect1> |
75 | ||
76 | <refsect1> | |
77 | <title>Options</title> | |
78 | ||
79 | <para>The following options are understood:</para> | |
80 | ||
81 | <variablelist> | |
4a6022f0 ZJS |
82 | <varlistentry> |
83 | <term><option>-t</option></term> | |
84 | <term><option>--type=</option></term> | |
85 | ||
86 | <listitem> | |
e9dd9f95 | 87 | <para>The argument should be a comma-separated list of unit |
20b3f379 | 88 | types such as <option>service</option> and |
9b9b3d36 MW |
89 | <option>socket</option>. |
90 | </para> | |
20b3f379 ZJS |
91 | |
92 | <para>If one of the arguments is a unit type, when listing | |
7b870f60 | 93 | units, limit display to certain unit types. Otherwise, units |
4a6022f0 ZJS |
94 | of all types will be shown.</para> |
95 | ||
20b3f379 | 96 | <para>As a special case, if one of the arguments is |
4a6022f0 ZJS |
97 | <option>help</option>, a list of allowed values will be |
98 | printed and the program will exit.</para> | |
99 | </listitem> | |
100 | </varlistentry> | |
101 | ||
9b9b3d36 MW |
102 | <varlistentry> |
103 | <term><option>--state=</option></term> | |
104 | ||
105 | <listitem> | |
e16972e6 ZJS |
106 | <para>The argument should be a comma-separated list of unit |
107 | LOAD, SUB, or ACTIVE states. When listing units, show only | |
a8eaaee7 | 108 | those in the specified states. Use <option>--state=failed</option> |
e16972e6 ZJS |
109 | to show only failed units.</para> |
110 | ||
111 | <para>As a special case, if one of the arguments is | |
112 | <option>help</option>, a list of allowed values will be | |
113 | printed and the program will exit.</para> | |
9b9b3d36 MW |
114 | </listitem> |
115 | </varlistentry> | |
116 | ||
4a6022f0 ZJS |
117 | <varlistentry> |
118 | <term><option>-p</option></term> | |
119 | <term><option>--property=</option></term> | |
120 | ||
121 | <listitem> | |
54c31a79 | 122 | <para>When showing unit/job/manager properties with the |
ea539eb6 ZJS |
123 | <command>show</command> command, limit display to properties |
124 | specified in the argument. The argument should be a | |
d2bbca68 | 125 | comma-separated list of property names, such as |
ea539eb6 ZJS |
126 | <literal>MainPID</literal>. Unless specified, all known |
127 | properties are shown. If specified more than once, all | |
128 | properties with the specified names are shown. Shell | |
129 | completion is implemented for property names.</para> | |
130 | ||
131 | <para>For the manager itself, | |
132 | <command>systemctl show</command> will show all available | |
133 | properties. Those properties are documented in | |
134 | <citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>. | |
135 | </para> | |
136 | ||
137 | <para>Properties for units vary by unit type, so showing any | |
138 | unit (even a non-existent one) is a way to list properties | |
b938cb90 | 139 | pertaining to this type. Similarly, showing any job will list |
ea539eb6 ZJS |
140 | properties pertaining to all jobs. Properties for units are |
141 | documented in | |
142 | <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
143 | and the pages for individual unit types | |
144 | <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
145 | <citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
146 | etc.</para> | |
4a6022f0 ZJS |
147 | </listitem> |
148 | </varlistentry> | |
149 | ||
150 | <varlistentry> | |
151 | <term><option>-a</option></term> | |
152 | <term><option>--all</option></term> | |
153 | ||
154 | <listitem> | |
21b587cf ZJS |
155 | <para>When listing units with <command>list-units</command>, also show inactive units and |
156 | units which are following other units. When showing unit/job/manager properties, show all | |
157 | properties regardless whether they are set or not.</para> | |
158 | ||
159 | <para>To list all units installed in the file system, use the | |
a5e4972c | 160 | <command>list-unit-files</command> command instead.</para> |
e9fbae3f ZJS |
161 | |
162 | <para>When listing units with <command>list-dependencies</command>, recursively show | |
163 | dependencies of all dependent units (by default only dependencies of target units are | |
164 | shown).</para> | |
4a6022f0 ZJS |
165 | </listitem> |
166 | </varlistentry> | |
167 | ||
1238ee09 LP |
168 | <varlistentry> |
169 | <term><option>-r</option></term> | |
170 | <term><option>--recursive</option></term> | |
171 | ||
172 | <listitem> | |
173 | <para>When listing units, also show units of local | |
174 | containers. Units of local containers will be prefixed with | |
175 | the container name, separated by a single colon character | |
176 | (<literal>:</literal>).</para> | |
177 | </listitem> | |
178 | </varlistentry> | |
179 | ||
afba4199 ZJS |
180 | <varlistentry> |
181 | <term><option>--reverse</option></term> | |
182 | ||
183 | <listitem> | |
184 | <para>Show reverse dependencies between units with | |
f6375e83 ZJS |
185 | <command>list-dependencies</command>, i.e. follow |
186 | dependencies of type <varname>WantedBy=</varname>, | |
187 | <varname>RequiredBy=</varname>, | |
f6375e83 ZJS |
188 | <varname>PartOf=</varname>, <varname>BoundBy=</varname>, |
189 | instead of <varname>Wants=</varname> and similar. | |
afba4199 ZJS |
190 | </para> |
191 | </listitem> | |
192 | </varlistentry> | |
193 | ||
194 | <varlistentry> | |
195 | <term><option>--after</option></term> | |
9029f642 JSJ |
196 | |
197 | <listitem> | |
198 | <para>With <command>list-dependencies</command>, show the | |
199 | units that are ordered before the specified unit. In other | |
f6375e83 ZJS |
200 | words, recursively list units following the |
201 | <varname>After=</varname> dependency.</para> | |
202 | ||
203 | <para>Note that any <varname>After=</varname> dependency is | |
204 | automatically mirrored to create a | |
205 | <varname>Before=</varname> dependency. Temporal dependencies | |
922d948b | 206 | may be specified explicitly, but are also created implicitly |
f6375e83 ZJS |
207 | for units which are <varname>WantedBy=</varname> targets |
208 | (see | |
209 | <citerefentry><refentrytitle>systemd.target</refentrytitle><manvolnum>5</manvolnum></citerefentry>), | |
210 | and as a result of other directives (for example | |
211 | <varname>RequiresMountsFor=</varname>). Both explicitly | |
212 | and implicitly introduced dependencies are shown with | |
213 | <command>list-dependencies</command>.</para> | |
82948f6c LP |
214 | |
215 | <para>When passed to the <command>list-jobs</command> command, for each printed job show which other jobs are | |
216 | waiting for it. May be combined with <option>--before</option> to show both the jobs waiting for each job as | |
217 | well as all jobs each job is waiting for.</para> | |
9029f642 JSJ |
218 | </listitem> |
219 | </varlistentry> | |
220 | ||
221 | <varlistentry> | |
afba4199 ZJS |
222 | <term><option>--before</option></term> |
223 | ||
224 | <listitem> | |
9029f642 JSJ |
225 | <para>With <command>list-dependencies</command>, show the |
226 | units that are ordered after the specified unit. In other | |
f6375e83 ZJS |
227 | words, recursively list units following the |
228 | <varname>Before=</varname> dependency.</para> | |
82948f6c LP |
229 | |
230 | <para>When passed to the <command>list-jobs</command> command, for each printed job show which other jobs it | |
231 | is waiting for. May be combined with <option>--after</option> to show both the jobs waiting for each job as | |
232 | well as all jobs each job is waiting for.</para> | |
afba4199 ZJS |
233 | </listitem> |
234 | </varlistentry> | |
235 | ||
4a6022f0 | 236 | <varlistentry> |
98a6e132 | 237 | <term><option>-l</option></term> |
4a6022f0 ZJS |
238 | <term><option>--full</option></term> |
239 | ||
240 | <listitem> | |
69d918b0 ZJS |
241 | <para>Do not ellipsize unit names, process tree entries, |
242 | journal output, or truncate unit descriptions in the output | |
243 | of <command>status</command>, <command>list-units</command>, | |
244 | <command>list-jobs</command>, and | |
245 | <command>list-timers</command>.</para> | |
3b3557c4 JS |
246 | <para>Also, show installation targets in the output of |
247 | <command>is-enabled</command>.</para> | |
4a6022f0 ZJS |
248 | </listitem> |
249 | </varlistentry> | |
250 | ||
4f9a9105 ZJS |
251 | <varlistentry> |
252 | <term><option>--value</option></term> | |
253 | ||
254 | <listitem> | |
255 | <para>When printing properties with <command>show</command>, | |
256 | only print the value, and skip the property name and | |
257 | <literal>=</literal>.</para> | |
258 | </listitem> | |
259 | </varlistentry> | |
260 | ||
991f2a39 ZJS |
261 | <varlistentry> |
262 | <term><option>--show-types</option></term> | |
263 | ||
264 | <listitem> | |
265 | <para>When showing sockets, show the type of the socket.</para> | |
266 | </listitem> | |
267 | </varlistentry> | |
268 | ||
23ade460 | 269 | <varlistentry> |
4dc5b821 | 270 | <term><option>--job-mode=</option></term> |
23ade460 MS |
271 | |
272 | <listitem> | |
e0e009c0 JE |
273 | <para>When queuing a new job, this option controls how to deal with |
274 | already queued jobs. It takes one of <literal>fail</literal>, | |
4dc5b821 LP |
275 | <literal>replace</literal>, |
276 | <literal>replace-irreversibly</literal>, | |
277 | <literal>isolate</literal>, | |
278 | <literal>ignore-dependencies</literal>, | |
279 | <literal>ignore-requirements</literal> or | |
280 | <literal>flush</literal>. Defaults to | |
281 | <literal>replace</literal>, except when the | |
282 | <command>isolate</command> command is used which implies the | |
283 | <literal>isolate</literal> job mode.</para> | |
284 | ||
285 | <para>If <literal>fail</literal> is specified and a requested | |
286 | operation conflicts with a pending job (more specifically: | |
287 | causes an already pending start job to be reversed into a stop | |
288 | job or vice versa), cause the operation to fail.</para> | |
289 | ||
290 | <para>If <literal>replace</literal> (the default) is | |
291 | specified, any conflicting pending job will be replaced, as | |
292 | necessary.</para> | |
293 | ||
294 | <para>If <literal>replace-irreversibly</literal> is specified, | |
295 | operate like <literal>replace</literal>, but also mark the new | |
296 | jobs as irreversible. This prevents future conflicting | |
9a92e77e DS |
297 | transactions from replacing these jobs (or even being enqueued |
298 | while the irreversible jobs are still pending). Irreversible | |
299 | jobs can still be cancelled using the <command>cancel</command> | |
d60cb656 AJ |
300 | command. This job mode should be used on any transaction which |
301 | pulls in <filename>shutdown.target</filename>.</para> | |
4dc5b821 LP |
302 | |
303 | <para><literal>isolate</literal> is only valid for start | |
304 | operations and causes all other units to be stopped when the | |
305 | specified unit is started. This mode is always used when the | |
306 | <command>isolate</command> command is used.</para> | |
307 | ||
308 | <para><literal>flush</literal> will cause all queued jobs to | |
309 | be canceled when the new job is enqueued.</para> | |
310 | ||
311 | <para>If <literal>ignore-dependencies</literal> is specified, | |
312 | then all unit dependencies are ignored for this new job and | |
313 | the operation is executed immediately. If passed, no required | |
314 | units of the unit passed will be pulled in, and no ordering | |
315 | dependencies will be honored. This is mostly a debugging and | |
316 | rescue tool for the administrator and should not be used by | |
317 | applications.</para> | |
318 | ||
319 | <para><literal>ignore-requirements</literal> is similar to | |
b040723e | 320 | <literal>ignore-dependencies</literal>, but only causes the |
4dc5b821 | 321 | requirement dependencies to be ignored, the ordering |
2dd67817 | 322 | dependencies will still be honored.</para> |
23ade460 | 323 | </listitem> |
4a6022f0 | 324 | |
4a6022f0 ZJS |
325 | </varlistentry> |
326 | ||
ac5e3a50 JS |
327 | <varlistentry> |
328 | <term><option>--fail</option></term> | |
329 | ||
330 | <listitem> | |
331 | <para>Shorthand for <option>--job-mode=</option>fail.</para> | |
332 | <para>When used with the <command>kill</command> command, | |
333 | if no units were killed, the operation results in an error. | |
334 | </para> | |
335 | </listitem> | |
336 | </varlistentry> | |
337 | ||
4a6022f0 ZJS |
338 | <varlistentry> |
339 | <term><option>-i</option></term> | |
340 | <term><option>--ignore-inhibitors</option></term> | |
341 | ||
342 | <listitem> | |
343 | <para>When system shutdown or a sleep state is requested, | |
344 | ignore inhibitor locks. Applications can establish inhibitor | |
345 | locks to avoid that certain important operations (such as CD | |
346 | burning or suchlike) are interrupted by system shutdown or a | |
347 | sleep state. Any user may take these locks and privileged | |
348 | users may override these locks. If any locks are taken, | |
349 | shutdown and sleep state requests will normally fail | |
494a6682 | 350 | (regardless of whether privileged or not) and a list of active locks |
7b870f60 JE |
351 | is printed. However, if <option>--ignore-inhibitors</option> |
352 | is specified, the locks are ignored and not printed, and the | |
4a6022f0 ZJS |
353 | operation attempted anyway, possibly requiring additional |
354 | privileges.</para> | |
355 | </listitem> | |
356 | </varlistentry> | |
357 | ||
1ae17672 ZJS |
358 | <varlistentry> |
359 | <term><option>--dry-run</option></term> | |
360 | ||
361 | <listitem> | |
362 | <para>Just print what would be done. Currently supported by verbs | |
363 | <command>halt</command>, <command>poweroff</command>, <command>reboot</command>, | |
364 | <command>kexec</command>, <command>suspend</command>, | |
365 | <command>hibernate</command>, <command>hybrid-sleep</command>, | |
366 | <command>default</command>, <command>rescue</command>, | |
367 | <command>emergency</command>, and <command>exit</command>.</para> | |
368 | </listitem> | |
369 | </varlistentry> | |
370 | ||
4a6022f0 ZJS |
371 | <varlistentry> |
372 | <term><option>-q</option></term> | |
373 | <term><option>--quiet</option></term> | |
374 | ||
375 | <listitem> | |
bbd46aad ZJS |
376 | <para>Suppress printing of the results of various commands |
377 | and also the hints about truncated log lines. This does not | |
378 | suppress output of commands for which the printed output is | |
379 | the only result (like <command>show</command>). Errors are | |
380 | always printed.</para> | |
4a6022f0 ZJS |
381 | </listitem> |
382 | </varlistentry> | |
383 | ||
384 | <varlistentry> | |
385 | <term><option>--no-block</option></term> | |
386 | ||
387 | <listitem> | |
388 | <para>Do not synchronously wait for the requested operation | |
7b870f60 | 389 | to finish. If this is not specified, the job will be |
4a6022f0 | 390 | verified, enqueued and <command>systemctl</command> will |
3d161f99 | 391 | wait until the unit's start-up is completed. By passing this |
93a08841 MP |
392 | argument, it is only verified and enqueued. This option may not be |
393 | combined with <option>--wait</option>.</para> | |
394 | </listitem> | |
395 | </varlistentry> | |
396 | ||
397 | <varlistentry> | |
398 | <term><option>--wait</option></term> | |
399 | ||
400 | <listitem> | |
401 | <para>Synchronously wait for started units to terminate again. | |
402 | This option may not be combined with <option>--no-block</option>. | |
403 | Note that this will wait forever if any given unit never terminates | |
404 | (by itself or by getting stopped explicitly); particularly services | |
405 | which use <literal>RemainAfterExit=yes</literal>.</para> | |
4a6022f0 ZJS |
406 | </listitem> |
407 | </varlistentry> | |
408 | ||
88ae7333 ZJS |
409 | <xi:include href="user-system-options.xml" xpointer="user" /> |
410 | <xi:include href="user-system-options.xml" xpointer="system" /> | |
4a6022f0 | 411 | |
bef19548 ZJS |
412 | <varlistentry> |
413 | <term><option>--failed</option></term> | |
414 | ||
415 | <listitem> | |
416 | <para>List units in failed state. This is equivalent to | |
417 | <option>--state=failed</option>.</para> | |
418 | </listitem> | |
419 | </varlistentry> | |
599b6322 | 420 | |
4a6022f0 ZJS |
421 | <varlistentry> |
422 | <term><option>--no-wall</option></term> | |
423 | ||
424 | <listitem> | |
6324a8a7 | 425 | <para>Do not send wall message before halt, power-off and reboot.</para> |
4a6022f0 ZJS |
426 | </listitem> |
427 | </varlistentry> | |
428 | ||
429 | <varlistentry> | |
430 | <term><option>--global</option></term> | |
431 | ||
432 | <listitem> | |
433 | <para>When used with <command>enable</command> and | |
434 | <command>disable</command>, operate on the global user | |
435 | configuration directory, thus enabling or disabling a unit | |
436 | file globally for all future logins of all users.</para> | |
437 | </listitem> | |
438 | </varlistentry> | |
439 | ||
440 | <varlistentry> | |
441 | <term><option>--no-reload</option></term> | |
442 | ||
443 | <listitem> | |
444 | <para>When used with <command>enable</command> and | |
445 | <command>disable</command>, do not implicitly reload daemon | |
446 | configuration after executing the changes.</para> | |
447 | </listitem> | |
448 | </varlistentry> | |
449 | ||
450 | <varlistentry> | |
451 | <term><option>--no-ask-password</option></term> | |
452 | ||
453 | <listitem> | |
454 | <para>When used with <command>start</command> and related | |
455 | commands, disables asking for passwords. Background services | |
456 | may require input of a password or passphrase string, for | |
457 | example to unlock system hard disks or cryptographic | |
458 | certificates. Unless this option is specified and the | |
7b870f60 | 459 | command is invoked from a terminal, |
4a6022f0 ZJS |
460 | <command>systemctl</command> will query the user on the |
461 | terminal for the necessary secrets. Use this option to | |
7b870f60 | 462 | switch this behavior off. In this case, the password must be |
4a6022f0 ZJS |
463 | supplied by some other means (for example graphical password |
464 | agents) or the service might fail. This also disables | |
465 | querying the user for authentication for privileged | |
466 | operations.</para> | |
467 | </listitem> | |
4a6022f0 ZJS |
468 | </varlistentry> |
469 | ||
470 | <varlistentry> | |
471 | <term><option>--kill-who=</option></term> | |
472 | ||
473 | <listitem> | |
474 | <para>When used with <command>kill</command>, choose which | |
af7424af LP |
475 | processes to send a signal to. Must be one of |
476 | <option>main</option>, <option>control</option> or | |
477 | <option>all</option> to select whether to kill only the main | |
478 | process, the control process or all processes of the | |
479 | unit. The main process of the unit is the one that defines | |
480 | the life-time of it. A control process of a unit is one that | |
481 | is invoked by the manager to induce state changes of it. For | |
482 | example, all processes started due to the | |
483 | <varname>ExecStartPre=</varname>, | |
484 | <varname>ExecStop=</varname> or | |
485 | <varname>ExecReload=</varname> settings of service units are | |
486 | control processes. Note that there is only one control | |
487 | process per unit at a time, as only one state change is | |
488 | executed at a time. For services of type | |
b8bde116 | 489 | <varname>Type=forking</varname>, the initial process started |
af7424af LP |
490 | by the manager for <varname>ExecStart=</varname> is a |
491 | control process, while the process ultimately forked off by | |
492 | that one is then considered the main process of the unit (if | |
493 | it can be determined). This is different for service units | |
494 | of other types, where the process forked off by the manager | |
495 | for <varname>ExecStart=</varname> is always the main process | |
b8bde116 JE |
496 | itself. A service unit consists of zero or one main process, |
497 | zero or one control process plus any number of additional | |
af7424af | 498 | processes. Not all unit types manage processes of these |
b8bde116 | 499 | types however. For example, for mount units, control processes |
af7424af | 500 | are defined (which are the invocations of |
d31dd62b FB |
501 | <filename>&MOUNT_PATH;</filename> and |
502 | <filename>&UMOUNT_PATH;</filename>), but no main process | |
af7424af LP |
503 | is defined. If omitted, defaults to |
504 | <option>all</option>.</para> | |
4a6022f0 ZJS |
505 | </listitem> |
506 | ||
507 | </varlistentry> | |
508 | ||
509 | <varlistentry> | |
510 | <term><option>-s</option></term> | |
511 | <term><option>--signal=</option></term> | |
512 | ||
513 | <listitem> | |
514 | <para>When used with <command>kill</command>, choose which | |
515 | signal to send to selected processes. Must be one of the | |
b938cb90 | 516 | well-known signal specifiers such as <constant>SIGTERM</constant>, <constant>SIGINT</constant> or |
7b870f60 | 517 | <constant>SIGSTOP</constant>. If omitted, defaults to |
4a6022f0 ZJS |
518 | <option>SIGTERM</option>.</para> |
519 | </listitem> | |
520 | </varlistentry> | |
521 | ||
522 | <varlistentry> | |
523 | <term><option>-f</option></term> | |
524 | <term><option>--force</option></term> | |
525 | ||
526 | <listitem> | |
527 | <para>When used with <command>enable</command>, overwrite | |
528 | any existing conflicting symlinks.</para> | |
529 | ||
39c38ce1 DC |
530 | <para>When used with <command>edit</command>, create all of the |
531 | specified units which do not already exist.</para> | |
532 | ||
924e44b4 LP |
533 | <para>When used with <command>halt</command>, <command>poweroff</command>, <command>reboot</command> or |
534 | <command>kexec</command>, execute the selected operation without shutting down all units. However, all | |
535 | processes will be killed forcibly and all file systems are unmounted or remounted read-only. This is hence a | |
536 | drastic but relatively safe option to request an immediate reboot. If <option>--force</option> is specified | |
537 | twice for these operations (with the exception of <command>kexec</command>), they will be executed | |
538 | immediately, without terminating any processes or unmounting any file systems. Warning: specifying | |
539 | <option>--force</option> twice with any of these operations might result in data loss. Note that when | |
540 | <option>--force</option> is specified twice the selected operation is executed by | |
541 | <command>systemctl</command> itself, and the system manager is not contacted. This means the command should | |
6324a8a7 | 542 | succeed even when the system manager has crashed.</para> |
4a6022f0 ZJS |
543 | </listitem> |
544 | </varlistentry> | |
545 | ||
9ef15026 JS |
546 | <varlistentry> |
547 | <term><option>--message=</option></term> | |
548 | ||
549 | <listitem> | |
6324a8a7 LP |
550 | <para>When used with <command>halt</command>, <command>poweroff</command> or <command>reboot</command>, set a |
551 | short message explaining the reason for the operation. The message will be logged together with the default | |
552 | shutdown message.</para> | |
9ef15026 JS |
553 | </listitem> |
554 | </varlistentry> | |
555 | ||
57ab2eab JS |
556 | <varlistentry> |
557 | <term><option>--now</option></term> | |
558 | ||
559 | <listitem> | |
560 | <para>When used with <command>enable</command>, the units | |
561 | will also be started. When used with <command>disable</command> or | |
562 | <command>mask</command>, the units will also be stopped. The start | |
563 | or stop operation is only carried out when the respective enable or | |
564 | disable operation has been successful.</para> | |
565 | </listitem> | |
566 | </varlistentry> | |
567 | ||
4a6022f0 ZJS |
568 | <varlistentry> |
569 | <term><option>--root=</option></term> | |
570 | ||
571 | <listitem> | |
572 | <para>When used with | |
573 | <command>enable</command>/<command>disable</command>/<command>is-enabled</command> | |
9b914a9d ZJS |
574 | (and related commands), use the specified root path when looking for unit |
575 | files. If this option is present, <command>systemctl</command> will operate on | |
576 | the file system directly, instead of communicating with the <command>systemd</command> | |
577 | daemon to carry out changes.</para> | |
4a6022f0 ZJS |
578 | </listitem> |
579 | ||
580 | </varlistentry> | |
581 | ||
582 | <varlistentry> | |
583 | <term><option>--runtime</option></term> | |
584 | ||
585 | <listitem> | |
a330b376 | 586 | <para>When used with <command>enable</command>, |
7d4fb3b1 | 587 | <command>disable</command>, <command>edit</command>, |
4a6022f0 | 588 | (and related commands), make changes only temporarily, so |
a330b376 | 589 | that they are lost on the next reboot. This will have the |
4a6022f0 ZJS |
590 | effect that changes are not made in subdirectories of |
591 | <filename>/etc</filename> but in <filename>/run</filename>, | |
592 | with identical immediate effects, however, since the latter | |
593 | is lost on reboot, the changes are lost too.</para> | |
a330b376 | 594 | |
494a6682 | 595 | <para>Similarly, when used with |
fbce1139 | 596 | <command>set-property</command>, make changes only |
a330b376 LP |
597 | temporarily, so that they are lost on the next |
598 | reboot.</para> | |
4a6022f0 ZJS |
599 | </listitem> |
600 | </varlistentry> | |
601 | ||
d309c1c3 LP |
602 | <varlistentry> |
603 | <term><option>--preset-mode=</option></term> | |
604 | ||
605 | <listitem> | |
606 | <para>Takes one of <literal>full</literal> (the default), | |
607 | <literal>enable-only</literal>, | |
8d0e0ddd | 608 | <literal>disable-only</literal>. When used with the |
d309c1c3 | 609 | <command>preset</command> or <command>preset-all</command> |
8d0e0ddd | 610 | commands, controls whether units shall be disabled and |
d309c1c3 LP |
611 | enabled according to the preset rules, or only enabled, or |
612 | only disabled.</para> | |
613 | </listitem> | |
614 | </varlistentry> | |
615 | ||
4a6022f0 ZJS |
616 | <varlistentry> |
617 | <term><option>-n</option></term> | |
618 | <term><option>--lines=</option></term> | |
619 | ||
620 | <listitem> | |
7b870f60 | 621 | <para>When used with <command>status</command>, controls the |
4a6022f0 ZJS |
622 | number of journal lines to show, counting from the most |
623 | recent ones. Takes a positive integer argument. Defaults to | |
624 | 10.</para> | |
625 | </listitem> | |
626 | </varlistentry> | |
627 | ||
628 | <varlistentry> | |
629 | <term><option>-o</option></term> | |
630 | <term><option>--output=</option></term> | |
631 | ||
632 | <listitem> | |
7b870f60 | 633 | <para>When used with <command>status</command>, controls the |
4a6022f0 | 634 | formatting of the journal entries that are shown. For the |
7b870f60 | 635 | available choices, see |
4a6022f0 ZJS |
636 | <citerefentry><refentrytitle>journalctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>. |
637 | Defaults to <literal>short</literal>.</para> | |
638 | </listitem> | |
639 | </varlistentry> | |
640 | ||
5bdf2243 JJ |
641 | <varlistentry> |
642 | <term><option>--firmware-setup</option></term> | |
643 | ||
644 | <listitem> | |
645 | <para>When used with the <command>reboot</command> command, | |
646 | indicate to the system's firmware to boot into setup | |
647 | mode. Note that this is currently only supported on some EFI | |
648 | systems and only if the system was booted in EFI | |
649 | mode.</para> | |
650 | </listitem> | |
651 | </varlistentry> | |
652 | ||
5d0c05e5 LN |
653 | <varlistentry> |
654 | <term><option>--plain</option></term> | |
655 | ||
656 | <listitem> | |
7b870f60 | 657 | <para>When used with <command>list-dependencies</command>, |
831d3dc8 | 658 | <command>list-units</command> or <command>list-machines</command>, |
a20e43c0 MT |
659 | the output is printed as a list instead of a tree, and the bullet |
660 | circles are omitted.</para> | |
5d0c05e5 LN |
661 | </listitem> |
662 | </varlistentry> | |
663 | ||
4f50d2ef ZJS |
664 | <xi:include href="user-system-options.xml" xpointer="host" /> |
665 | <xi:include href="user-system-options.xml" xpointer="machine" /> | |
666 | ||
12f15e59 ZJS |
667 | <xi:include href="standard-options.xml" xpointer="no-pager" /> |
668 | <xi:include href="standard-options.xml" xpointer="no-legend" /> | |
dfdebb1b ZJS |
669 | <xi:include href="standard-options.xml" xpointer="help" /> |
670 | <xi:include href="standard-options.xml" xpointer="version" /> | |
4a6022f0 ZJS |
671 | </variablelist> |
672 | </refsect1> | |
673 | ||
674 | <refsect1> | |
675 | <title>Commands</title> | |
676 | ||
677 | <para>The following commands are understood:</para> | |
678 | ||
27722f96 LN |
679 | <refsect2> |
680 | <title>Unit Commands</title> | |
4a6022f0 | 681 | |
27722f96 LN |
682 | <variablelist> |
683 | <varlistentry> | |
1eecafb8 | 684 | <term><command>list-units <optional><replaceable>PATTERN</replaceable>…</optional></command></term> |
4a6022f0 | 685 | |
27722f96 | 686 | <listitem> |
2cdbbc9a LP |
687 | <para>List units that <command>systemd</command> currently has in memory. This includes units that are |
688 | either referenced directly or through a dependency, units that are pinned by applications programmatically, | |
689 | or units that were active in the past and have failed. By default only units which are active, have pending | |
690 | jobs, or have failed are shown; this can be changed with option <option>--all</option>. If one or more | |
05a98afd LP |
691 | <replaceable>PATTERN</replaceable>s are specified, only units matching one of them are shown. The units |
692 | that are shown are additionally filtered by <option>--type=</option> and <option>--state=</option> if those | |
693 | options are specified.</para> | |
991f2a39 | 694 | |
27722f96 LN |
695 | <para>This is the default command.</para> |
696 | </listitem> | |
697 | </varlistentry> | |
991f2a39 | 698 | |
27722f96 | 699 | <varlistentry> |
1eecafb8 | 700 | <term><command>list-sockets <optional><replaceable>PATTERN</replaceable>…</optional></command></term> |
27722f96 LN |
701 | |
702 | <listitem> | |
2cdbbc9a LP |
703 | <para>List socket units currently in memory, ordered by listening address. If one or more |
704 | <replaceable>PATTERN</replaceable>s are specified, only socket units matching one of them are | |
d8fba7c6 | 705 | shown. Produces output similar to |
27722f96 | 706 | <programlisting> |
991f2a39 ZJS |
707 | LISTEN UNIT ACTIVATES |
708 | /dev/initctl systemd-initctl.socket systemd-initctl.service | |
1eecafb8 | 709 | … |
991f2a39 ZJS |
710 | [::]:22 sshd.socket sshd.service |
711 | kobject-uevent 1 systemd-udevd-kernel.socket systemd-udevd.service | |
712 | ||
9fccdb0f | 713 | 5 sockets listed.</programlisting> |
27722f96 LN |
714 | Note: because the addresses might contains spaces, this output |
715 | is not suitable for programmatic consumption. | |
716 | </para> | |
717 | ||
2cdbbc9a | 718 | <para>Also see <option>--show-types</option>, <option>--all</option>, and <option>--state=</option>.</para> |
27722f96 LN |
719 | </listitem> |
720 | </varlistentry> | |
721 | ||
cbb76c29 | 722 | <varlistentry> |
1eecafb8 | 723 | <term><command>list-timers <optional><replaceable>PATTERN</replaceable>…</optional></command></term> |
cbb76c29 LP |
724 | |
725 | <listitem> | |
2cdbbc9a LP |
726 | <para>List timer units currently in memory, ordered by the time they elapse next. If one or more |
727 | <replaceable>PATTERN</replaceable>s are specified, only units matching one of them are shown. | |
3c3fff44 | 728 | Produces output similar to |
ccdda955 MS |
729 | <programlisting> |
730 | NEXT LEFT LAST PASSED UNIT ACTIVATES | |
731 | n/a n/a Thu 2017-02-23 13:40:29 EST 3 days ago ureadahead-stop.timer ureadahead-stop.service | |
732 | Sun 2017-02-26 18:55:42 EST 1min 14s left Thu 2017-02-23 13:54:44 EST 3 days ago systemd-tmpfiles-clean.timer systemd-tmpfiles-clean.service | |
733 | Sun 2017-02-26 20:37:16 EST 1h 42min left Sun 2017-02-26 11:56:36 EST 6h ago apt-daily.timer apt-daily.service | |
734 | Sun 2017-02-26 20:57:49 EST 2h 3min left Sun 2017-02-26 11:56:36 EST 6h ago snapd.refresh.timer snapd.refresh.service | |
735 | </programlisting> | |
d8fba7c6 | 736 | </para> |
cbb76c29 | 737 | |
ccdda955 MS |
738 | <para><emphasis>NEXT</emphasis> shows the next time the timer will run.</para> |
739 | <para><emphasis>LEFT</emphasis> shows how long till the next time the timer runs.</para> | |
740 | <para><emphasis>LAST</emphasis> shows the last time the timer ran.</para> | |
741 | <para><emphasis>PASSED</emphasis> shows has long as passed since the timer laset ran.</para> | |
742 | <para><emphasis>UNIT</emphasis> shows the name of the timer</para> | |
785889e5 | 743 | <para><emphasis>ACTIVATES</emphasis> shows the name the service the timer activates when it runs.</para> |
ccdda955 | 744 | |
2cdbbc9a | 745 | <para>Also see <option>--all</option> and <option>--state=</option>.</para> |
cbb76c29 LP |
746 | </listitem> |
747 | </varlistentry> | |
748 | ||
27722f96 | 749 | <varlistentry> |
1eecafb8 | 750 | <term><command>start <replaceable>PATTERN</replaceable>…</command></term> |
27722f96 LN |
751 | |
752 | <listitem> | |
753 | <para>Start (activate) one or more units specified on the | |
754 | command line.</para> | |
e3e0314b | 755 | |
2cdbbc9a LP |
756 | <para>Note that glob patterns operate on the set of primary names of units currently in memory. Units which |
757 | are not active and are not in a failed state usually are not in memory, and will not be matched by any | |
1f00eded LP |
758 | pattern. In addition, in case of instantiated units, systemd is often unaware of the instance name until |
759 | the instance has been started. Therefore, using glob patterns with <command>start</command> has limited | |
760 | usefulness. Also, secondary alias names of units are not considered.</para> | |
27722f96 LN |
761 | </listitem> |
762 | </varlistentry> | |
763 | <varlistentry> | |
1eecafb8 | 764 | <term><command>stop <replaceable>PATTERN</replaceable>…</command></term> |
27722f96 LN |
765 | |
766 | <listitem> | |
767 | <para>Stop (deactivate) one or more units specified on the | |
768 | command line.</para> | |
769 | </listitem> | |
770 | </varlistentry> | |
771 | <varlistentry> | |
1eecafb8 | 772 | <term><command>reload <replaceable>PATTERN</replaceable>…</command></term> |
27722f96 LN |
773 | |
774 | <listitem> | |
775 | <para>Asks all units listed on the command line to reload | |
776 | their configuration. Note that this will reload the | |
777 | service-specific configuration, not the unit configuration | |
778 | file of systemd. If you want systemd to reload the | |
79640424 | 779 | configuration file of a unit, use the |
27722f96 LN |
780 | <command>daemon-reload</command> command. In other words: |
781 | for the example case of Apache, this will reload Apache's | |
782 | <filename>httpd.conf</filename> in the web server, not the | |
783 | <filename>apache.service</filename> systemd unit | |
784 | file.</para> | |
785 | ||
786 | <para>This command should not be confused with the | |
d0a3fb75 | 787 | <command>daemon-reload</command> command.</para> |
27722f96 LN |
788 | </listitem> |
789 | ||
790 | </varlistentry> | |
791 | <varlistentry> | |
1eecafb8 | 792 | <term><command>restart <replaceable>PATTERN</replaceable>…</command></term> |
27722f96 LN |
793 | |
794 | <listitem> | |
c4f2aaa4 LP |
795 | <para>Stop and then start one or more units specified on the command line. If the units are not running |
796 | yet, they will be started.</para> | |
797 | ||
798 | <para>Note that restarting a unit with this command does not necessarily flush out all of the unit's | |
799 | resources before it is started again. For example, the per-service file descriptor storage facility (see | |
800 | <varname>FileDescriptoreStoreMax=</varname> in | |
801 | <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>) will | |
802 | remain intact as long as the unit has a job pending, and is only cleared when the unit is fully stopped and | |
803 | no jobs are pending anymore. If it is intended that the file descriptor store is flushed out, too, during a | |
804 | restart operation an explicit <command>systemctl stop</command> command followed by <command>systemctl | |
805 | start</command> should be issued.</para> | |
27722f96 LN |
806 | </listitem> |
807 | </varlistentry> | |
808 | <varlistentry> | |
1eecafb8 | 809 | <term><command>try-restart <replaceable>PATTERN</replaceable>…</command></term> |
27722f96 LN |
810 | |
811 | <listitem> | |
6539dd7c | 812 | <para>Stop and then start one or more units specified on the |
813 | command line if the units are running. This does nothing | |
814 | if units are not running.</para> | |
2fcee0a5 LP |
815 | <!-- Note that we don't document condrestart here, as that is just compatibility support, and we generally |
816 | don't document that. --> | |
27722f96 LN |
817 | </listitem> |
818 | </varlistentry> | |
819 | <varlistentry> | |
1eecafb8 | 820 | <term><command>reload-or-restart <replaceable>PATTERN</replaceable>…</command></term> |
27722f96 LN |
821 | |
822 | <listitem> | |
ff946d82 LP |
823 | <para>Reload one or more units if they support it. If not, stop and then start them instead. If the units |
824 | are not running yet, they will be started.</para> | |
27722f96 LN |
825 | </listitem> |
826 | </varlistentry> | |
827 | <varlistentry> | |
1eecafb8 | 828 | <term><command>try-reload-or-restart <replaceable>PATTERN</replaceable>…</command></term> |
27722f96 LN |
829 | |
830 | <listitem> | |
ff946d82 LP |
831 | <para>Reload one or more units if they support it. If not, stop and then start them instead. This does |
832 | nothing if the units are not running.</para> | |
2fcee0a5 LP |
833 | <!-- Note that we don't document force-reload here, as that is just compatibility support, and we generally |
834 | don't document that. --> | |
27722f96 LN |
835 | </listitem> |
836 | </varlistentry> | |
837 | <varlistentry> | |
838 | <term><command>isolate <replaceable>NAME</replaceable></command></term> | |
839 | ||
840 | <listitem> | |
26adf774 ZJS |
841 | <para>Start the unit specified on the command line and its dependencies |
842 | and stop all others, unless they have | |
843 | <option>IgnoreOnIsolate=yes</option> (see | |
844 | <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>). | |
845 | If a unit name with no extension is given, an extension of | |
507e28d8 | 846 | <literal>.target</literal> will be assumed.</para> |
27722f96 LN |
847 | |
848 | <para>This is similar to changing the runlevel in a | |
849 | traditional init system. The <command>isolate</command> | |
850 | command will immediately stop processes that are not enabled | |
851 | in the new unit, possibly including the graphical | |
852 | environment or terminal you are currently using.</para> | |
853 | ||
854 | <para>Note that this is allowed only on units where | |
855 | <option>AllowIsolate=</option> is enabled. See | |
856 | <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry> | |
857 | for details.</para> | |
858 | </listitem> | |
859 | </varlistentry> | |
860 | <varlistentry> | |
1eecafb8 | 861 | <term><command>kill <replaceable>PATTERN</replaceable>…</command></term> |
27722f96 LN |
862 | |
863 | <listitem> | |
864 | <para>Send a signal to one or more processes of the | |
865 | unit. Use <option>--kill-who=</option> to select which | |
0088d631 LP |
866 | process to kill. Use <option>--signal=</option> to select |
867 | the signal to send.</para> | |
27722f96 LN |
868 | </listitem> |
869 | </varlistentry> | |
870 | <varlistentry> | |
1eecafb8 | 871 | <term><command>is-active <replaceable>PATTERN</replaceable>…</command></term> |
27722f96 LN |
872 | |
873 | <listitem> | |
874 | <para>Check whether any of the specified units are active | |
6db27428 ZJS |
875 | (i.e. running). Returns an exit code |
876 | <constant>0</constant> if at least one is active, or | |
877 | non-zero otherwise. Unless <option>--quiet</option> is | |
878 | specified, this will also print the current unit state to | |
879 | standard output.</para> | |
27722f96 LN |
880 | </listitem> |
881 | </varlistentry> | |
882 | <varlistentry> | |
1eecafb8 | 883 | <term><command>is-failed <replaceable>PATTERN</replaceable>…</command></term> |
27722f96 LN |
884 | |
885 | <listitem> | |
6db27428 ZJS |
886 | <para>Check whether any of the specified units are in a |
887 | "failed" state. Returns an exit code | |
888 | <constant>0</constant> if at least one has failed, | |
889 | non-zero otherwise. Unless <option>--quiet</option> is | |
890 | specified, this will also print the current unit state to | |
891 | standard output.</para> | |
27722f96 LN |
892 | </listitem> |
893 | </varlistentry> | |
894 | <varlistentry> | |
1eecafb8 | 895 | <term><command>status</command> <optional><replaceable>PATTERN</replaceable>…|<replaceable>PID</replaceable>…]</optional></term> |
27722f96 LN |
896 | |
897 | <listitem> | |
898 | <para>Show terse runtime status information about one or | |
899 | more units, followed by most recent log data from the | |
8fcf784d | 900 | journal. If no units are specified, show system status. If |
b8bde116 | 901 | combined with <option>--all</option>, also show the status of |
8fcf784d LP |
902 | all units (subject to limitations specified with |
903 | <option>-t</option>). If a PID is passed, show information | |
904 | about the unit the process belongs to.</para> | |
27722f96 LN |
905 | |
906 | <para>This function is intended to generate human-readable | |
e213d1a3 | 907 | output. If you are looking for computer-parsable output, |
b938cb90 | 908 | use <command>show</command> instead. By default, this |
e213d1a3 | 909 | function only shows 10 lines of output and ellipsizes |
4559a721 | 910 | lines to fit in the terminal window. This can be changed |
e213d1a3 ZJS |
911 | with <option>--lines</option> and <option>--full</option>, |
912 | see above. In addition, <command>journalctl | |
913 | --unit=<replaceable>NAME</replaceable></command> or | |
914 | <command>journalctl | |
915 | --user-unit=<replaceable>NAME</replaceable></command> use | |
916 | a similar filter for messages and might be more | |
917 | convenient. | |
918 | </para> | |
ab8864eb MS |
919 | |
920 | <para>Systemd implicitly loads units as necessary, so just running the <command>status</command> will | |
921 | attempt to load a file. The command is thus not useful for determining if something was already loaded or | |
922 | not. The units may possibly also be quickly unloaded after the operation is completed if there's no reason | |
923 | to keep it in memory thereafter. | |
924 | </para> | |
925 | ||
926 | <example> | |
927 | <title>Example output from systemctl status </title> | |
928 | ||
929 | <programlisting>$ systemctl status bluetooth | |
930 | ● bluetooth.service - Bluetooth service | |
83ddf5d3 | 931 | Loaded: loaded (/usr/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled) |
ab8864eb MS |
932 | Active: active (running) since Wed 2017-01-04 13:54:04 EST; 1 weeks 0 days ago |
933 | Docs: man:bluetoothd(8) | |
934 | Main PID: 930 (bluetoothd) | |
935 | Status: "Running" | |
936 | Tasks: 1 | |
937 | Memory: 648.0K | |
938 | CPU: 435ms | |
939 | CGroup: /system.slice/bluetooth.service | |
940 | └─930 /usr/lib/bluetooth/bluetoothd | |
941 | ||
942 | Jan 12 10:46:45 example.com bluetoothd[8900]: Not enough free handles to register service | |
542ca7c9 DR |
943 | Jan 12 10:46:45 example.com bluetoothd[8900]: Current Time Service could not be registered |
944 | Jan 12 10:46:45 example.com bluetoothd[8900]: gatt-time-server: Input/output error (5) | |
ab8864eb MS |
945 | </programlisting> |
946 | ||
947 | <para>The dot ("●") uses color on supported terminals to summarize the unit state at a glance. White | |
948 | indicates an <literal>inactive</literal> or <literal>deactivating</literal> state. Red indicates a | |
949 | <literal>failed</literal> or <literal>error</literal> state and green indicates an | |
950 | <literal>active</literal>, <literal>reloading</literal> or <literal>activating</literal> state. | |
951 | </para> | |
952 | ||
953 | <para>The "Loaded:" line in the output will show <literal>loaded</literal> if the unit has been loaded into | |
954 | memory. Other possible values for "Loaded:" include: <literal>error</literal> if there was a problem | |
955 | loading it, <literal>not-found</literal>, and <literal>masked</literal>. Along with showing the path to | |
956 | the unit file, this line will also show the enablement state. Enabled commands start at boot. See the | |
957 | full table of possible enablement states — including the definition of <literal>masked</literal> — in the | |
958 | documentation for the <command>is-enabled</command> command. | |
959 | </para> | |
960 | ||
961 | <para>The "Active:" line shows active state. The value is usually <literal>active</literal> or | |
962 | <literal>inactive</literal>. Active could mean started, bound, plugged in, etc depending on the unit type. | |
963 | The unit could also be in process of changing states, reporting a state of <literal>activating</literal> or | |
964 | <literal>deactivating</literal>. A special <literal>failed</literal> state is entered when the service | |
965 | failed in some way, such as a crash, exiting with an error code or timing out. If the failed state is | |
966 | entered the cause will be logged for later reference.</para> | |
967 | </example> | |
968 | ||
27722f96 LN |
969 | </listitem> |
970 | </varlistentry> | |
971 | <varlistentry> | |
1eecafb8 | 972 | <term><command>show</command> <optional><replaceable>PATTERN</replaceable>…|<replaceable>JOB</replaceable>…</optional></term> |
27722f96 LN |
973 | |
974 | <listitem> | |
33d2308c LP |
975 | <para>Show properties of one or more units, jobs, or the manager itself. If no argument is specified, |
976 | properties of the manager will be shown. If a unit name is specified, properties of the unit are shown, and | |
977 | if a job ID is specified, properties of the job are shown. By default, empty properties are suppressed. Use | |
978 | <option>--all</option> to show those too. To select specific properties to show, use | |
979 | <option>--property=</option>. This command is intended to be used whenever computer-parsable output is | |
980 | required. Use <command>status</command> if you are looking for formatted human-readable output.</para> | |
981 | ||
982 | <para>Many properties shown by <command>systemctl show</command> map directly to configuration settings of | |
983 | the system and service manager and its unit files. Note that the properties shown by the command are | |
984 | generally more low-level, normalized versions of the original configuration settings and expose runtime | |
985 | state in addition to configuration. For example, properties shown for service units include the service's | |
986 | current main process identifier as <literal>MainPID</literal> (which is runtime state), and time settings | |
987 | are always exposed as properties ending in the <literal>…USec</literal> suffix even if a matching | |
988 | configuration options end in <literal>…Sec</literal>, because microseconds is the normalized time unit used | |
989 | by the system and service manager.</para> | |
27722f96 LN |
990 | </listitem> |
991 | </varlistentry> | |
e93c33d4 | 992 | <varlistentry> |
1eecafb8 | 993 | <term><command>cat <replaceable>PATTERN</replaceable>…</command></term> |
27722f96 | 994 | |
e93c33d4 | 995 | <listitem> |
e4c0fbe5 ZJS |
996 | <para>Show backing files of one or more units. Prints the |
997 | "fragment" and "drop-ins" (source files) of units. Each | |
998 | file is preceded by a comment which includes the file | |
d4a48671 LW |
999 | name. Note that this shows the contents of the backing files |
1000 | on disk, which may not match the system manager's | |
1001 | understanding of these units if any unit files were | |
1002 | updated on disk and the <command>daemon-reload</command> | |
1003 | command wasn't issued since.</para> | |
e93c33d4 SL |
1004 | </listitem> |
1005 | </varlistentry> | |
27722f96 | 1006 | <varlistentry> |
1eecafb8 | 1007 | <term><command>set-property <replaceable>NAME</replaceable> <replaceable>ASSIGNMENT</replaceable>…</command></term> |
27722f96 LN |
1008 | |
1009 | <listitem> | |
1010 | <para>Set the specified unit properties at runtime where | |
1011 | this is supported. This allows changing configuration | |
3fde5f30 | 1012 | parameter properties such as resource control settings at |
27722f96 | 1013 | runtime. Not all properties may be changed at runtime, but |
3fde5f30 LP |
1014 | many resource control settings (primarily those in |
1015 | <citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>) | |
27722f96 LN |
1016 | may. The changes are applied instantly, and stored on disk |
1017 | for future boots, unless <option>--runtime</option> is | |
3fde5f30 LP |
1018 | passed, in which case the settings only apply until the |
1019 | next reboot. The syntax of the property assignment follows | |
27722f96 LN |
1020 | closely the syntax of assignments in unit files.</para> |
1021 | ||
1022 | <para>Example: <command>systemctl set-property foobar.service CPUShares=777</command></para> | |
1023 | ||
e9fd88f2 FB |
1024 | <para>If the specified unit appears to be inactive, the |
1025 | changes will be only stored on disk as described | |
1026 | previously hence they will be effective when the unit will | |
1027 | be started.</para> | |
1028 | ||
27722f96 LN |
1029 | <para>Note that this command allows changing multiple |
1030 | properties at the same time, which is preferable over | |
1031 | setting them individually. Like unit file configuration | |
1032 | settings, assigning the empty list to list parameters will | |
1033 | reset the list.</para> | |
1034 | </listitem> | |
1035 | </varlistentry> | |
1036 | ||
1037 | <varlistentry> | |
1eecafb8 | 1038 | <term><command>help <replaceable>PATTERN</replaceable>…|<replaceable>PID</replaceable>…</command></term> |
27722f96 LN |
1039 | |
1040 | <listitem> | |
1041 | <para>Show manual pages for one or more units, if | |
1042 | available. If a PID is given, the manual pages for the unit | |
1043 | the process belongs to are shown.</para> | |
1044 | </listitem> | |
1045 | </varlistentry> | |
1046 | ||
1047 | <varlistentry> | |
1eecafb8 | 1048 | <term><command>reset-failed [<replaceable>PATTERN</replaceable>…]</command></term> |
27722f96 LN |
1049 | |
1050 | <listitem> | |
ff946d82 LP |
1051 | <para>Reset the <literal>failed</literal> state of the specified units, or if no unit name is passed, reset |
1052 | the state of all units. When a unit fails in some way (i.e. process exiting with non-zero error code, | |
1053 | terminating abnormally or timing out), it will automatically enter the <literal>failed</literal> state and | |
1054 | its exit code and status is recorded for introspection by the administrator until the service is | |
1055 | stopped/re-started or reset with this command.</para> | |
27722f96 LN |
1056 | </listitem> |
1057 | </varlistentry> | |
1058 | ||
1059 | <varlistentry> | |
f6375e83 ZJS |
1060 | <term> |
1061 | <command>list-dependencies</command> | |
1062 | <optional><replaceable>NAME</replaceable></optional> | |
1063 | </term> | |
27722f96 LN |
1064 | |
1065 | <listitem> | |
f6375e83 ZJS |
1066 | <para>Shows units required and wanted by the specified |
1067 | unit. This recursively lists units following the | |
1068 | <varname>Requires=</varname>, | |
f6375e83 | 1069 | <varname>Requisite=</varname>, |
fb30c438 | 1070 | <varname>ConsistsOf=</varname>, |
f6375e83 ZJS |
1071 | <varname>Wants=</varname>, <varname>BindsTo=</varname> |
1072 | dependencies. If no unit is specified, | |
1073 | <filename>default.target</filename> is implied.</para> | |
1074 | ||
1075 | <para>By default, only target units are recursively | |
1076 | expanded. When <option>--all</option> is passed, all other | |
1077 | units are recursively expanded as well.</para> | |
1078 | ||
1079 | <para>Options <option>--reverse</option>, | |
1080 | <option>--after</option>, <option>--before</option> | |
1081 | may be used to change what types of dependencies | |
1082 | are shown.</para> | |
27722f96 LN |
1083 | </listitem> |
1084 | </varlistentry> | |
1085 | </variablelist> | |
1086 | </refsect2> | |
1087 | ||
1088 | <refsect2> | |
1089 | <title>Unit File Commands</title> | |
1090 | ||
1091 | <variablelist> | |
1092 | <varlistentry> | |
1eecafb8 | 1093 | <term><command>list-unit-files <optional><replaceable>PATTERN…</replaceable></optional></command></term> |
27722f96 LN |
1094 | |
1095 | <listitem> | |
3990961d LP |
1096 | <para>List unit files installed on the system, in combination with their enablement state (as reported by |
1097 | <command>is-enabled</command>). If one or more <replaceable>PATTERN</replaceable>s are specified, only unit | |
1098 | files whose name matches one of them are shown (patterns matching unit file system paths are not | |
1099 | supported).</para> | |
27722f96 LN |
1100 | </listitem> |
1101 | </varlistentry> | |
1102 | ||
1103 | <varlistentry> | |
1eecafb8 ZJS |
1104 | <term><command>enable <replaceable>NAME</replaceable>…</command></term> |
1105 | <term><command>enable <replaceable>PATH</replaceable>…</command></term> | |
27722f96 LN |
1106 | |
1107 | <listitem> | |
3990961d LP |
1108 | <para>Enable one or more units or unit instances. This will create a set of symlinks, as encoded in the |
1109 | <literal>[Install]</literal> sections of the indicated unit files. After the symlinks have been created, | |
1110 | the system manager configuration is reloaded (in a way equivalent to <command>daemon-reload</command>), in | |
1111 | order to ensure the changes are taken into account immediately. Note that this does | |
1112 | <emphasis>not</emphasis> have the effect of also starting any of the units being enabled. If this is | |
1113 | desired, combine this command with the <option>--now</option> switch, or invoke <command>start</command> | |
1114 | with appropriate arguments later. Note that in case of unit instance enablement (i.e. enablement of units of | |
1115 | the form <filename>foo@bar.service</filename>), symlinks named the same as instances are created in the | |
2dd67817 | 1116 | unit configuration directory, however they point to the single template unit file they are instantiated |
3990961d LP |
1117 | from.</para> |
1118 | ||
93f07c87 ZJS |
1119 | <para>This command expects either valid unit names (in which case various unit file directories are |
1120 | automatically searched for unit files with appropriate names), or absolute paths to unit files (in which | |
1121 | case these files are read directly). If a specified unit file is located outside of the usual unit file | |
1122 | directories, an additional symlink is created, linking it into the unit configuration path, thus ensuring | |
1123 | it is found when requested by commands such as <command>start</command>.</para> | |
3990961d LP |
1124 | |
1125 | <para>This command will print the file system operations executed. This output may be suppressed by passing | |
1126 | <option>--quiet</option>. | |
27722f96 LN |
1127 | </para> |
1128 | ||
3990961d LP |
1129 | <para>Note that this operation creates only the symlinks suggested in the <literal>[Install]</literal> |
1130 | section of the unit files. While this command is the recommended way to manipulate the unit configuration | |
1131 | directory, the administrator is free to make additional changes manually by placing or removing symlinks | |
1132 | below this directory. This is particularly useful to create configurations that deviate from the suggested | |
1133 | default installation. In this case, the administrator must make sure to invoke | |
1134 | <command>daemon-reload</command> manually as necessary, in order to ensure the changes are taken into | |
1135 | account. | |
27722f96 LN |
1136 | </para> |
1137 | ||
3990961d LP |
1138 | <para>Enabling units should not be confused with starting (activating) units, as done by the |
1139 | <command>start</command> command. Enabling and starting units is orthogonal: units may be enabled without | |
1140 | being started and started without being enabled. Enabling simply hooks the unit into various suggested | |
1141 | places (for example, so that the unit is automatically started on boot or when a particular kind of | |
1142 | hardware is plugged in). Starting actually spawns the daemon process (in case of service units), or binds | |
1143 | the socket (in case of socket units), and so on.</para> | |
1144 | ||
1145 | <para>Depending on whether <option>--system</option>, <option>--user</option>, <option>--runtime</option>, | |
1146 | or <option>--global</option> is specified, this enables the unit for the system, for the calling user only, | |
1d82e6b3 AJ |
1147 | for only this boot of the system, or for all future logins of all users. Note that in the last case, no |
1148 | systemd daemon configuration is reloaded.</para> | |
3990961d LP |
1149 | |
1150 | <para>Using <command>enable</command> on masked units is not supported and results in an error.</para> | |
27722f96 LN |
1151 | </listitem> |
1152 | </varlistentry> | |
1153 | ||
1154 | <varlistentry> | |
1eecafb8 | 1155 | <term><command>disable <replaceable>NAME</replaceable>…</command></term> |
27722f96 LN |
1156 | |
1157 | <listitem> | |
3990961d LP |
1158 | <para>Disables one or more units. This removes all symlinks to the unit files backing the specified units |
1159 | from the unit configuration directory, and hence undoes any changes made by <command>enable</command> or | |
1160 | <command>link</command>. Note that this removes <emphasis>all</emphasis> symlinks to matching unit files, | |
1161 | including manually created symlinks, and not just those actually created by <command>enable</command> or | |
1162 | <command>link</command>. Note that while <command>disable</command> undoes the effect of | |
1163 | <command>enable</command>, the two commands are otherwise not symmetric, as <command>disable</command> may | |
1164 | remove more symlinks than a prior <command>enable</command> invocation of the same unit created.</para> | |
1165 | ||
1166 | <para>This command expects valid unit names only, it does not accept paths to unit files.</para> | |
1167 | ||
1168 | <para>In addition to the units specified as arguments, all units are disabled that are listed in the | |
1169 | <varname>Also=</varname> setting contained in the <literal>[Install]</literal> section of any of the unit | |
1170 | files being operated on.</para> | |
1171 | ||
1172 | <para>This command implicitly reloads the system manager configuration after completing the operation. Note | |
1173 | that this command does not implicitly stop the units that are being disabled. If this is desired, either | |
1174 | combine this command with the <option>--now</option> switch, or invoke the <command>stop</command> command | |
1175 | with appropriate arguments later.</para> | |
1176 | ||
1177 | <para>This command will print information about the file system operations (symlink removals) | |
1178 | executed. This output may be suppressed by passing <option>--quiet</option>. | |
27722f96 LN |
1179 | </para> |
1180 | ||
3990961d LP |
1181 | <para>This command honors <option>--system</option>, <option>--user</option>, <option>--runtime</option> |
1182 | and <option>--global</option> in a similar way as <command>enable</command>.</para> | |
27722f96 LN |
1183 | </listitem> |
1184 | </varlistentry> | |
1185 | ||
b619ec8f | 1186 | <varlistentry> |
1eecafb8 | 1187 | <term><command>reenable <replaceable>NAME</replaceable>…</command></term> |
b619ec8f LP |
1188 | |
1189 | <listitem> | |
3990961d LP |
1190 | <para>Reenable one or more units, as specified on the command line. This is a combination of |
1191 | <command>disable</command> and <command>enable</command> and is useful to reset the symlinks a unit file is | |
d903a892 | 1192 | enabled with to the defaults configured in its <literal>[Install]</literal> section. This command expects |
1193 | a unit name only, it does not accept paths to unit files.</para> | |
b619ec8f LP |
1194 | </listitem> |
1195 | </varlistentry> | |
1196 | ||
1197 | <varlistentry> | |
1eecafb8 | 1198 | <term><command>preset <replaceable>NAME</replaceable>…</command></term> |
b619ec8f LP |
1199 | |
1200 | <listitem> | |
39207373 ZJS |
1201 | <para>Reset the enable/disable status one or more unit files, as specified on |
1202 | the command line, to the defaults configured in the preset policy files. This | |
1203 | has the same effect as <command>disable</command> or | |
1204 | <command>enable</command>, depending how the unit is listed in the preset | |
1205 | files.</para> | |
b619ec8f | 1206 | |
39207373 ZJS |
1207 | <para>Use <option>--preset-mode=</option> to control whether units shall be |
1208 | enabled and disabled, or only enabled, or only disabled.</para> | |
1209 | ||
1210 | <para>If the unit carries no install information, it will be silently ignored | |
d923e42e ZJS |
1211 | by this command. <replaceable>NAME</replaceable> must be the real unit name, |
1212 | any alias names are ignored silently.</para> | |
b619ec8f | 1213 | |
39207373 | 1214 | <para>For more information on the preset policy format, see |
b619ec8f | 1215 | <citerefentry><refentrytitle>systemd.preset</refentrytitle><manvolnum>5</manvolnum></citerefentry>. |
39207373 | 1216 | For more information on the concept of presets, please consult the |
28a0ad81 | 1217 | <ulink url="https://www.freedesktop.org/wiki/Software/systemd/Preset">Preset</ulink> |
b619ec8f LP |
1218 | document.</para> |
1219 | </listitem> | |
1220 | </varlistentry> | |
1221 | ||
1222 | <varlistentry> | |
1223 | <term><command>preset-all</command></term> | |
1224 | ||
1225 | <listitem> | |
1226 | <para>Resets all installed unit files to the defaults | |
1227 | configured in the preset policy file (see above).</para> | |
1228 | ||
1229 | <para>Use <option>--preset-mode=</option> to control | |
1230 | whether units shall be enabled and disabled, or only | |
1231 | enabled, or only disabled.</para> | |
1232 | </listitem> | |
1233 | </varlistentry> | |
1234 | ||
27722f96 | 1235 | <varlistentry> |
1eecafb8 | 1236 | <term><command>is-enabled <replaceable>NAME</replaceable>…</command></term> |
27722f96 LN |
1237 | |
1238 | <listitem> | |
1239 | <para>Checks whether any of the specified unit files are | |
171754aa ZJS |
1240 | enabled (as with <command>enable</command>). Returns an |
1241 | exit code of 0 if at least one is enabled, non-zero | |
1242 | otherwise. Prints the current enable status (see table). | |
1243 | To suppress this output, use <option>--quiet</option>. | |
3b3557c4 | 1244 | To show installation targets, use <option>--full</option>. |
171754aa ZJS |
1245 | </para> |
1246 | ||
1247 | <table> | |
1248 | <title> | |
1249 | <command>is-enabled</command> output | |
1250 | </title> | |
1251 | ||
1252 | <tgroup cols='3'> | |
1253 | <thead> | |
1254 | <row> | |
94f099d8 LP |
1255 | <entry>Name</entry> |
1256 | <entry>Description</entry> | |
1257 | <entry>Exit Code</entry> | |
171754aa ZJS |
1258 | </row> |
1259 | </thead> | |
1260 | <tbody> | |
1261 | <row> | |
1262 | <entry><literal>enabled</literal></entry> | |
5cd8ae31 | 1263 | <entry morerows='1'>Enabled via <filename>.wants/</filename>, <filename>.requires/</filename> or <varname>Alias=</varname> symlinks (permanently in <filename>/etc/systemd/system/</filename>, or transiently in <filename>/run/systemd/system/</filename>).</entry> |
171754aa ZJS |
1264 | <entry morerows='1'>0</entry> |
1265 | </row> | |
1266 | <row> | |
1267 | <entry><literal>enabled-runtime</literal></entry> | |
1268 | </row> | |
1269 | <row> | |
1270 | <entry><literal>linked</literal></entry> | |
48563081 | 1271 | <entry morerows='1'>Made available through one or more symlinks to the unit file (permanently in <filename>/etc/systemd/system/</filename> or transiently in <filename>/run/systemd/system/</filename>), even though the unit file might reside outside of the unit file search path.</entry> |
94f099d8 | 1272 | <entry morerows='1'>> 0</entry> |
171754aa ZJS |
1273 | </row> |
1274 | <row> | |
1275 | <entry><literal>linked-runtime</literal></entry> | |
1276 | </row> | |
1277 | <row> | |
1278 | <entry><literal>masked</literal></entry> | |
48563081 | 1279 | <entry morerows='1'>Completely disabled, so that any start operation on it fails (permanently in <filename>/etc/systemd/system/</filename> or transiently in <filename>/run/systemd/systemd/</filename>).</entry> |
94f099d8 | 1280 | <entry morerows='1'>> 0</entry> |
171754aa ZJS |
1281 | </row> |
1282 | <row> | |
1283 | <entry><literal>masked-runtime</literal></entry> | |
1284 | </row> | |
1285 | <row> | |
1286 | <entry><literal>static</literal></entry> | |
f4139308 | 1287 | <entry>The unit file is not enabled, and has no provisions for enabling in the <literal>[Install]</literal> unit file section.</entry> |
91f0ac7d | 1288 | <entry>0</entry> |
171754aa | 1289 | </row> |
aedd4012 JS |
1290 | <row> |
1291 | <entry><literal>indirect</literal></entry> | |
d9b4b48f | 1292 | <entry>The unit file itself is not enabled, but it has a non-empty <varname>Also=</varname> setting in the <literal>[Install]</literal> unit file section, listing other unit files that might be enabled, or it has an alias under a different name through a symlink that is not specified in Also=. For template unit file, an instance different than the one specified in <varname>DefaultInstance=</varname> is enabled.</entry> |
aedd4012 JS |
1293 | <entry>0</entry> |
1294 | </row> | |
171754aa ZJS |
1295 | <row> |
1296 | <entry><literal>disabled</literal></entry> | |
f4139308 | 1297 | <entry>The unit file is not enabled, but contains an <literal>[Install]</literal> section with installation instructions.</entry> |
94f099d8 | 1298 | <entry>> 0</entry> |
171754aa | 1299 | </row> |
f4139308 LP |
1300 | <row> |
1301 | <entry><literal>generated</literal></entry> | |
1302 | <entry>The unit file was generated dynamically via a generator tool. See <citerefentry><refentrytitle>systemd.generator</refentrytitle><manvolnum>7</manvolnum></citerefentry>. Generated unit files may not be enabled, they are enabled implicitly by their generator.</entry> | |
1303 | <entry>0</entry> | |
1304 | </row> | |
e4fca67f LP |
1305 | <row> |
1306 | <entry><literal>transient</literal></entry> | |
1307 | <entry>The unit file has been created dynamically with the runtime API. Transient units may not be enabled.</entry> | |
1308 | <entry>0</entry> | |
1309 | </row> | |
0ec0deaa LP |
1310 | <row> |
1311 | <entry><literal>bad</literal></entry> | |
f4139308 | 1312 | <entry>The unit file is invalid or another error occurred. Note that <command>is-enabled</command> will not actually return this state, but print an error message instead. However the unit file listing printed by <command>list-unit-files</command> might show it.</entry> |
0ec0deaa LP |
1313 | <entry>> 0</entry> |
1314 | </row> | |
171754aa ZJS |
1315 | </tbody> |
1316 | </tgroup> | |
1317 | </table> | |
1318 | ||
27722f96 LN |
1319 | </listitem> |
1320 | </varlistentry> | |
1321 | ||
27722f96 | 1322 | <varlistentry> |
1eecafb8 | 1323 | <term><command>mask <replaceable>NAME</replaceable>…</command></term> |
27722f96 LN |
1324 | |
1325 | <listitem> | |
3990961d LP |
1326 | <para>Mask one or more units, as specified on the command line. This will link these unit files to |
1327 | <filename>/dev/null</filename>, making it impossible to start them. This is a stronger version of | |
1328 | <command>disable</command>, since it prohibits all kinds of activation of the unit, including enablement | |
1329 | and manual activation. Use this option with care. This honors the <option>--runtime</option> option to only | |
1330 | mask temporarily until the next reboot of the system. The <option>--now</option> option may be used to | |
1331 | ensure that the units are also stopped. This command expects valid unit names only, it does not accept unit | |
1332 | file paths.</para> | |
27722f96 LN |
1333 | </listitem> |
1334 | </varlistentry> | |
1335 | ||
1336 | <varlistentry> | |
1eecafb8 | 1337 | <term><command>unmask <replaceable>NAME</replaceable>…</command></term> |
27722f96 LN |
1338 | |
1339 | <listitem> | |
3990961d LP |
1340 | <para>Unmask one or more unit files, as specified on the command line. This will undo the effect of |
1341 | <command>mask</command>. This command expects valid unit names only, it does not accept unit file | |
1342 | paths.</para> | |
27722f96 LN |
1343 | </listitem> |
1344 | </varlistentry> | |
1345 | ||
1346 | <varlistentry> | |
1eecafb8 | 1347 | <term><command>link <replaceable>PATH</replaceable>…</command></term> |
27722f96 LN |
1348 | |
1349 | <listitem> | |
3990961d LP |
1350 | <para>Link a unit file that is not in the unit file search paths into the unit file search path. This |
1351 | command expects an absolute path to a unit file. The effect of this may be undone with | |
1352 | <command>disable</command>. The effect of this command is that a unit file is made available for commands | |
1353 | such as <command>start</command>, even though it is not installed directly in the unit search path.</para> | |
27722f96 LN |
1354 | </listitem> |
1355 | </varlistentry> | |
1356 | ||
344ca755 | 1357 | <varlistentry> |
1eecafb8 | 1358 | <term><command>revert <replaceable>NAME</replaceable>…</command></term> |
344ca755 LP |
1359 | |
1360 | <listitem> | |
1361 | <para>Revert one or more unit files to their vendor versions. This command removes drop-in configuration | |
1362 | files that modify the specified units, as well as any user-configured unit file that overrides a matching | |
1363 | vendor supplied unit file. Specifically, for a unit <literal>foo.service</literal> the matching directories | |
1364 | <literal>foo.service.d/</literal> with all their contained files are removed, both below the persistent and | |
1365 | runtime configuration directories (i.e. below <filename>/etc/systemd/system</filename> and | |
1366 | <filename>/run/systemd/system</filename>); if the unit file has a vendor-supplied version (i.e. a unit file | |
b17649ee | 1367 | located below <filename>/usr</filename>) any matching persistent or runtime unit file that overrides it is |
344ca755 LP |
1368 | removed, too. Note that if a unit file has no vendor-supplied version (i.e. is only defined below |
1369 | <filename>/etc/systemd/system</filename> or <filename>/run/systemd/system</filename>, but not in a unit | |
1370 | file stored below <filename>/usr</filename>), then it is not removed. Also, if a unit is masked, it is | |
1371 | unmasked.</para> | |
1372 | ||
1373 | <para>Effectively, this command may be used to undo all changes made with <command>systemctl | |
1374 | edit</command>, <command>systemctl set-property</command> and <command>systemctl mask</command> and puts | |
1375 | the original unit file with its settings back in effect.</para> | |
1376 | </listitem> | |
1377 | </varlistentry> | |
1378 | ||
27722f96 | 1379 | <varlistentry> |
b619ec8f | 1380 | <term><command>add-wants <replaceable>TARGET</replaceable> |
1eecafb8 | 1381 | <replaceable>NAME</replaceable>…</command></term> |
b619ec8f | 1382 | <term><command>add-requires <replaceable>TARGET</replaceable> |
1eecafb8 | 1383 | <replaceable>NAME</replaceable>…</command></term> |
27722f96 LN |
1384 | |
1385 | <listitem> | |
853382da | 1386 | <para>Adds <literal>Wants=</literal> or <literal>Requires=</literal> |
a8eaaee7 | 1387 | dependencies, respectively, to the specified |
853382da | 1388 | <replaceable>TARGET</replaceable> for one or more units. </para> |
27722f96 | 1389 | |
b619ec8f LP |
1390 | <para>This command honors <option>--system</option>, |
1391 | <option>--user</option>, <option>--runtime</option> and | |
a8eaaee7 | 1392 | <option>--global</option> in a way similar to |
b619ec8f | 1393 | <command>enable</command>.</para> |
27722f96 | 1394 | |
27722f96 LN |
1395 | </listitem> |
1396 | </varlistentry> | |
7d4fb3b1 RC |
1397 | |
1398 | <varlistentry> | |
1eecafb8 | 1399 | <term><command>edit <replaceable>NAME</replaceable>…</command></term> |
7d4fb3b1 RC |
1400 | |
1401 | <listitem> | |
1402 | <para>Edit a drop-in snippet or a whole replacement file if | |
1403 | <option>--full</option> is specified, to extend or override the | |
1404 | specified unit.</para> | |
1405 | ||
1406 | <para>Depending on whether <option>--system</option> (the default), | |
1407 | <option>--user</option>, or <option>--global</option> is specified, | |
a8eaaee7 | 1408 | this command creates a drop-in file for each unit either for the system, |
b938cb90 | 1409 | for the calling user, or for all futures logins of all users. Then, |
7d4fb3b1 RC |
1410 | the editor (see the "Environment" section below) is invoked on |
1411 | temporary files which will be written to the real location if the | |
1412 | editor exits successfully.</para> | |
1413 | ||
1414 | <para>If <option>--full</option> is specified, this will copy the | |
1415 | original units instead of creating drop-in files.</para> | |
1416 | ||
39c38ce1 DC |
1417 | <para>If <option>--force</option> is specified and any units do |
1418 | not already exist, new unit files will be opened for editing.</para> | |
1419 | ||
7d4fb3b1 RC |
1420 | <para>If <option>--runtime</option> is specified, the changes will |
1421 | be made temporarily in <filename>/run</filename> and they will be | |
1422 | lost on the next reboot.</para> | |
1423 | ||
b938cb90 JE |
1424 | <para>If the temporary file is empty upon exit, the modification of |
1425 | the related unit is canceled.</para> | |
7d4fb3b1 RC |
1426 | |
1427 | <para>After the units have been edited, systemd configuration is | |
1428 | reloaded (in a way that is equivalent to <command>daemon-reload</command>). | |
1429 | </para> | |
1430 | ||
1431 | <para>Note that this command cannot be used to remotely edit units | |
1432 | and that you cannot temporarily edit units which are in | |
b938cb90 | 1433 | <filename>/etc</filename>, since they take precedence over |
7d4fb3b1 RC |
1434 | <filename>/run</filename>.</para> |
1435 | </listitem> | |
1436 | </varlistentry> | |
b619ec8f LP |
1437 | |
1438 | <varlistentry> | |
1439 | <term><command>get-default</command></term> | |
1440 | ||
1441 | <listitem> | |
1442 | <para>Return the default target to boot into. This returns | |
1443 | the target unit name <filename>default.target</filename> | |
1444 | is aliased (symlinked) to.</para> | |
1445 | </listitem> | |
1446 | </varlistentry> | |
1447 | ||
1448 | <varlistentry> | |
1449 | <term><command>set-default <replaceable>NAME</replaceable></command></term> | |
1450 | ||
1451 | <listitem> | |
1452 | <para>Set the default target to boot into. This sets | |
1453 | (symlinks) the <filename>default.target</filename> alias | |
1454 | to the given target unit.</para> | |
1455 | </listitem> | |
1456 | </varlistentry> | |
1457 | ||
27722f96 LN |
1458 | </variablelist> |
1459 | </refsect2> | |
1460 | ||
0d292f5e LP |
1461 | <refsect2> |
1462 | <title>Machine Commands</title> | |
1463 | ||
1464 | <variablelist> | |
1465 | <varlistentry> | |
1eecafb8 | 1466 | <term><command>list-machines <optional><replaceable>PATTERN</replaceable>…</optional></command></term> |
0d292f5e LP |
1467 | |
1468 | <listitem> | |
1469 | <para>List the host and all running local containers with | |
1470 | their state. If one or more | |
1471 | <replaceable>PATTERN</replaceable>s are specified, only | |
1472 | containers matching one of them are shown. | |
1473 | </para> | |
1474 | </listitem> | |
1475 | </varlistentry> | |
1476 | </variablelist> | |
1477 | </refsect2> | |
1478 | ||
27722f96 LN |
1479 | <refsect2> |
1480 | <title>Job Commands</title> | |
1481 | ||
1482 | <variablelist> | |
1483 | <varlistentry> | |
1eecafb8 | 1484 | <term><command>list-jobs <optional><replaceable>PATTERN…</replaceable></optional></command></term> |
27722f96 LN |
1485 | |
1486 | <listitem> | |
d8fba7c6 ZJS |
1487 | <para>List jobs that are in progress. If one or more |
1488 | <replaceable>PATTERN</replaceable>s are specified, only | |
1489 | jobs for units matching one of them are shown.</para> | |
82948f6c LP |
1490 | |
1491 | <para>When combined with <option>--after</option> or <option>--before</option> the list is augmented with | |
1492 | information on which other job each job is waiting for, and which other jobs are waiting for it, see | |
1493 | above.</para> | |
27722f96 LN |
1494 | </listitem> |
1495 | </varlistentry> | |
1496 | <varlistentry> | |
1eecafb8 | 1497 | <term><command>cancel <replaceable>JOB</replaceable>…</command></term> |
27722f96 LN |
1498 | |
1499 | <listitem> | |
1500 | <para>Cancel one or more jobs specified on the command line | |
1501 | by their numeric job IDs. If no job ID is specified, cancel | |
1502 | all pending jobs.</para> | |
1503 | </listitem> | |
1504 | </varlistentry> | |
1505 | </variablelist> | |
27722f96 LN |
1506 | </refsect2> |
1507 | ||
1508 | <refsect2> | |
1509 | <title>Environment Commands</title> | |
1510 | ||
1511 | <variablelist> | |
1512 | <varlistentry> | |
1513 | <term><command>show-environment</command></term> | |
1514 | ||
1515 | <listitem> | |
804ee07c ZJS |
1516 | <para>Dump the systemd manager environment block. This is the environment |
1517 | block that is passed to all processes the manager spawns. The environment | |
1518 | block will be dumped in straight-forward form suitable for sourcing into | |
1519 | most shells. If no special characters or whitespace is present in the variable | |
1520 | values, no escaping is performed, and the assignments have the form | |
1521 | <literal>VARIABLE=value</literal>. If whitespace or characters which have | |
1522 | special meaning to the shell are present, dollar-single-quote escaping is | |
1523 | used, and assignments have the form <literal>VARIABLE=$'value'</literal>. | |
1524 | This syntax is known to be supported by | |
1525 | <citerefentry project='die-net'><refentrytitle>bash</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
1526 | <citerefentry project='die-net'><refentrytitle>zsh</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
1527 | <citerefentry project='die-net'><refentrytitle>ksh</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
1528 | and | |
1529 | <citerefentry project='die-net'><refentrytitle>busybox</refentrytitle><manvolnum>1</manvolnum></citerefentry>'s | |
1530 | <citerefentry project='die-net'><refentrytitle>ash</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
1531 | but not | |
1532 | <citerefentry project='die-net'><refentrytitle>dash</refentrytitle><manvolnum>1</manvolnum></citerefentry> | |
1533 | or | |
1534 | <citerefentry project='die-net'><refentrytitle>fish</refentrytitle><manvolnum>1</manvolnum></citerefentry>. | |
1535 | </para> | |
27722f96 LN |
1536 | </listitem> |
1537 | </varlistentry> | |
1538 | <varlistentry> | |
1eecafb8 | 1539 | <term><command>set-environment <replaceable>VARIABLE=VALUE</replaceable>…</command></term> |
27722f96 LN |
1540 | |
1541 | <listitem> | |
1542 | <para>Set one or more systemd manager environment variables, | |
1543 | as specified on the command line.</para> | |
1544 | </listitem> | |
1545 | </varlistentry> | |
1546 | <varlistentry> | |
1eecafb8 | 1547 | <term><command>unset-environment <replaceable>VARIABLE</replaceable>…</command></term> |
27722f96 LN |
1548 | |
1549 | <listitem> | |
1550 | <para>Unset one or more systemd manager environment | |
1551 | variables. If only a variable name is specified, it will be | |
1552 | removed regardless of its value. If a variable and a value | |
1553 | are specified, the variable is only removed if it has the | |
1554 | specified value.</para> | |
1555 | </listitem> | |
ac3efa8a LP |
1556 | </varlistentry> |
1557 | <varlistentry> | |
3fb90db2 | 1558 | <term> |
b975b0d5 | 1559 | <command>import-environment</command> |
1eecafb8 | 1560 | <optional><replaceable>VARIABLE…</replaceable></optional> |
b975b0d5 | 1561 | </term> |
ac3efa8a LP |
1562 | |
1563 | <listitem> | |
1564 | <para>Import all, one or more environment variables set on | |
1565 | the client into the systemd manager environment block. If | |
73e231ab JE |
1566 | no arguments are passed, the entire environment block is |
1567 | imported. Otherwise, a list of one or more environment | |
1568 | variable names should be passed, whose client-side values | |
ac3efa8a LP |
1569 | are then imported into the manager's environment |
1570 | block.</para> | |
1571 | </listitem> | |
27722f96 LN |
1572 | </varlistentry> |
1573 | </variablelist> | |
1574 | </refsect2> | |
1575 | ||
1576 | <refsect2> | |
1577 | <title>Manager Lifecycle Commands</title> | |
1578 | ||
1579 | <variablelist> | |
1580 | <varlistentry> | |
1581 | <term><command>daemon-reload</command></term> | |
1582 | ||
1583 | <listitem> | |
a8eaaee7 | 1584 | <para>Reload the systemd manager configuration. This will |
432d5965 ZJS |
1585 | rerun all generators (see |
1586 | <citerefentry><refentrytitle>systemd.generator</refentrytitle><manvolnum>7</manvolnum></citerefentry>), | |
1587 | reload all unit files, and recreate the entire dependency | |
1588 | tree. While the daemon is being reloaded, all sockets | |
1589 | systemd listens on behalf of user configuration will stay | |
1590 | accessible.</para> | |
1591 | ||
1592 | <para>This command should not be confused with the | |
1593 | <command>reload</command> command.</para> | |
27722f96 LN |
1594 | </listitem> |
1595 | </varlistentry> | |
1596 | <varlistentry> | |
1597 | <term><command>daemon-reexec</command></term> | |
1598 | ||
1599 | <listitem> | |
1600 | <para>Reexecute the systemd manager. This will serialize the | |
1601 | manager state, reexecute the process and deserialize the | |
1602 | state again. This command is of little use except for | |
79640424 | 1603 | debugging and package upgrades. Sometimes, it might be |
27722f96 | 1604 | helpful as a heavy-weight <command>daemon-reload</command>. |
79640424 | 1605 | While the daemon is being reexecuted, all sockets systemd listening |
27722f96 LN |
1606 | on behalf of user configuration will stay accessible. |
1607 | </para> | |
1608 | </listitem> | |
1609 | </varlistentry> | |
1610 | </variablelist> | |
1611 | </refsect2> | |
1612 | ||
1613 | <refsect2> | |
1614 | <title>System Commands</title> | |
1615 | ||
1616 | <variablelist> | |
99813a19 LP |
1617 | <varlistentry> |
1618 | <term><command>is-system-running</command></term> | |
1619 | ||
1620 | <listitem> | |
2de51fdc | 1621 | <para>Checks whether the system is operational. This |
94f099d8 LP |
1622 | returns success (exit code 0) when the system is fully up |
1623 | and running, specifically not in startup, shutdown or | |
1624 | maintenance mode, and with no failed services. Failure is | |
1625 | returned otherwise (exit code non-zero). In addition, the | |
2de51fdc | 1626 | current state is printed in a short string to standard |
a8eaaee7 | 1627 | output, see the table below. Use <option>--quiet</option> to |
2de51fdc ZJS |
1628 | suppress this output.</para> |
1629 | ||
1630 | <table> | |
94f099d8 LP |
1631 | <title><command>is-system-running</command> output</title> |
1632 | <tgroup cols='3'> | |
1633 | <colspec colname='name'/> | |
1634 | <colspec colname='description'/> | |
1635 | <colspec colname='exit-code'/> | |
2de51fdc ZJS |
1636 | <thead> |
1637 | <row> | |
1638 | <entry>Name</entry> | |
1639 | <entry>Description</entry> | |
94f099d8 | 1640 | <entry>Exit Code</entry> |
2de51fdc ZJS |
1641 | </row> |
1642 | </thead> | |
1643 | <tbody> | |
1644 | <row> | |
1645 | <entry><varname>initializing</varname></entry> | |
1646 | <entry><para>Early bootup, before | |
1fdfa094 LP |
1647 | <filename>basic.target</filename> is reached |
1648 | or the <varname>maintenance</varname> state entered. | |
2de51fdc | 1649 | </para></entry> |
94f099d8 | 1650 | <entry>> 0</entry> |
2de51fdc ZJS |
1651 | </row> |
1652 | <row> | |
1653 | <entry><varname>starting</varname></entry> | |
1fdfa094 LP |
1654 | <entry><para>Late bootup, before the job queue |
1655 | becomes idle for the first time, or one of the | |
1656 | rescue targets are reached.</para></entry> | |
94f099d8 | 1657 | <entry>> 0</entry> |
2de51fdc ZJS |
1658 | </row> |
1659 | <row> | |
1660 | <entry><varname>running</varname></entry> | |
1661 | <entry><para>The system is fully | |
1662 | operational.</para></entry> | |
94f099d8 | 1663 | <entry>0</entry> |
2de51fdc ZJS |
1664 | </row> |
1665 | <row> | |
1666 | <entry><varname>degraded</varname></entry> | |
1667 | <entry><para>The system is operational but one or more | |
1668 | units failed.</para></entry> | |
94f099d8 | 1669 | <entry>> 0</entry> |
2de51fdc ZJS |
1670 | </row> |
1671 | <row> | |
1672 | <entry><varname>maintenance</varname></entry> | |
1fdfa094 | 1673 | <entry><para>The rescue or emergency target is |
2de51fdc | 1674 | active.</para></entry> |
94f099d8 | 1675 | <entry>> 0</entry> |
2de51fdc ZJS |
1676 | </row> |
1677 | <row> | |
1678 | <entry><varname>stopping</varname></entry> | |
1679 | <entry><para>The manager is shutting | |
1680 | down.</para></entry> | |
94f099d8 LP |
1681 | <entry>> 0</entry> |
1682 | </row> | |
1683 | <row> | |
1684 | <entry><varname>offline</varname></entry> | |
1685 | <entry><para>The manager is not | |
1686 | running. Specifically, this is the operational | |
1687 | state if an incompatible program is running as | |
1688 | system manager (PID 1).</para></entry> | |
1689 | <entry>> 0</entry> | |
1690 | </row> | |
1691 | <row> | |
1692 | <entry><varname>unknown</varname></entry> | |
1693 | <entry><para>The operational state could not be | |
1694 | determined, due to lack of resources or another | |
1695 | error cause.</para></entry> | |
1696 | <entry>> 0</entry> | |
2de51fdc ZJS |
1697 | </row> |
1698 | </tbody> | |
1699 | </tgroup> | |
1700 | </table> | |
99813a19 LP |
1701 | </listitem> |
1702 | </varlistentry> | |
1703 | ||
27722f96 LN |
1704 | <varlistentry> |
1705 | <term><command>default</command></term> | |
1706 | ||
1707 | <listitem> | |
6324a8a7 LP |
1708 | <para>Enter default mode. This is equivalent to <command>systemctl isolate default.target</command>. This |
1709 | operation is blocking by default, use <option>--no-block</option> to request asynchronous behavior.</para> | |
27722f96 LN |
1710 | </listitem> |
1711 | </varlistentry> | |
99813a19 | 1712 | |
27722f96 LN |
1713 | <varlistentry> |
1714 | <term><command>rescue</command></term> | |
1715 | ||
1716 | <listitem> | |
6324a8a7 LP |
1717 | <para>Enter rescue mode. This is equivalent to <command>systemctl isolate rescue.target</command>. This |
1718 | operation is blocking by default, use <option>--no-block</option> to request asynchronous behavior.</para> | |
27722f96 LN |
1719 | </listitem> |
1720 | </varlistentry> | |
1721 | <varlistentry> | |
1722 | <term><command>emergency</command></term> | |
1723 | ||
1724 | <listitem> | |
6324a8a7 LP |
1725 | <para>Enter emergency mode. This is equivalent to <command>systemctl isolate |
1726 | emergency.target</command>. This operation is blocking by default, use <option>--no-block</option> to | |
1727 | request asynchronous behavior.</para> | |
27722f96 LN |
1728 | </listitem> |
1729 | </varlistentry> | |
1730 | <varlistentry> | |
1731 | <term><command>halt</command></term> | |
1732 | ||
1733 | <listitem> | |
6324a8a7 LP |
1734 | <para>Shut down and halt the system. This is mostly equivalent to <command>systemctl start halt.target |
1735 | --job-mode=replace-irreversibly --no-block</command>, but also prints a wall message to all users. This command is | |
1736 | asynchronous; it will return after the halt operation is enqueued, without waiting for it to complete. Note | |
1737 | that this operation will simply halt the OS kernel after shutting down, leaving the hardware powered | |
1738 | on. Use <command>systemctl poweroff</command> for powering off the system (see below).</para> | |
1739 | ||
1740 | <para>If combined with <option>--force</option>, shutdown of all running services is skipped, however all | |
1741 | processes are killed and all file systems are unmounted or mounted read-only, immediately followed by the | |
1742 | system halt. If <option>--force</option> is specified twice, the operation is immediately executed without | |
1743 | terminating any processes or unmounting any file systems. This may result in data loss. Note that when | |
1744 | <option>--force</option> is specified twice the halt operation is executed by <command>systemctl</command> | |
1745 | itself, and the system manager is not contacted. This means the command should succeed even when the system | |
1746 | manager has crashed.</para> | |
27722f96 LN |
1747 | </listitem> |
1748 | </varlistentry> | |
1749 | <varlistentry> | |
1750 | <term><command>poweroff</command></term> | |
1751 | ||
1752 | <listitem> | |
6324a8a7 LP |
1753 | <para>Shut down and power-off the system. This is mostly equivalent to <command>systemctl start |
1754 | poweroff.target --job-mode=replace-irreversibly --no-block</command>, but also prints a wall message to all | |
1755 | users. This command is asynchronous; it will return after the power-off operation is enqueued, without | |
1756 | waiting for it to complete.</para> | |
1757 | ||
1758 | <para>If combined with <option>--force</option>, shutdown of all running services is skipped, however all | |
1759 | processes are killed and all file systems are unmounted or mounted read-only, immediately followed by the | |
1760 | powering off. If <option>--force</option> is specified twice, the operation is immediately executed without | |
1761 | terminating any processes or unmounting any file systems. This may result in data loss. Note that when | |
924e44b4 LP |
1762 | <option>--force</option> is specified twice the power-off operation is executed by |
1763 | <command>systemctl</command> itself, and the system manager is not contacted. This means the command should | |
6324a8a7 | 1764 | succeed even when the system manager has crashed.</para> |
27722f96 LN |
1765 | </listitem> |
1766 | </varlistentry> | |
1767 | <varlistentry> | |
37185ec8 | 1768 | <term><command>reboot <optional><replaceable>arg</replaceable></optional></command></term> |
27722f96 LN |
1769 | |
1770 | <listitem> | |
6324a8a7 LP |
1771 | <para>Shut down and reboot the system. This is mostly equivalent to <command>systemctl start reboot.target |
1772 | --job-mode=replace-irreversibly --no-block</command>, but also prints a wall message to all users. This | |
1773 | command is asynchronous; it will return after the reboot operation is enqueued, without waiting for it to | |
1774 | complete.</para> | |
1775 | ||
1776 | <para>If combined with <option>--force</option>, shutdown of all running services is skipped, however all | |
1777 | processes are killed and all file systems are unmounted or mounted read-only, immediately followed by the | |
1778 | reboot. If <option>--force</option> is specified twice, the operation is immediately executed without | |
1779 | terminating any processes or unmounting any file systems. This may result in data loss. Note that when | |
924e44b4 LP |
1780 | <option>--force</option> is specified twice the reboot operation is executed by |
1781 | <command>systemctl</command> itself, and the system manager is not contacted. This means the command should | |
6324a8a7 LP |
1782 | succeed even when the system manager has crashed.</para> |
1783 | ||
1784 | <para>If the optional argument <replaceable>arg</replaceable> is given, it will be passed as the optional | |
1785 | argument to the <citerefentry><refentrytitle>reboot</refentrytitle><manvolnum>2</manvolnum></citerefentry> | |
1786 | system call. The value is architecture and firmware specific. As an example, <literal>recovery</literal> | |
1787 | might be used to trigger system recovery, and <literal>fota</literal> might be used to trigger a | |
37185ec8 | 1788 | <quote>firmware over the air</quote> update.</para> |
27722f96 LN |
1789 | </listitem> |
1790 | </varlistentry> | |
b619ec8f | 1791 | |
27722f96 LN |
1792 | <varlistentry> |
1793 | <term><command>kexec</command></term> | |
1794 | ||
1795 | <listitem> | |
6324a8a7 LP |
1796 | <para>Shut down and reboot the system via <command>kexec</command>. This is equivalent to |
1797 | <command>systemctl start kexec.target --job-mode=replace-irreversibly --no-block</command>. This command is | |
1798 | asynchronous; it will return after the reboot operation is enqueued, without waiting for it to | |
1799 | complete.</para> | |
1800 | ||
1801 | <para>If combined with <option>--force</option>, shutdown of all running services is skipped, however all | |
1802 | processes are killed and all file systems are unmounted or mounted read-only, immediately followed by the | |
1803 | reboot.</para> | |
27722f96 LN |
1804 | </listitem> |
1805 | </varlistentry> | |
b619ec8f | 1806 | |
27722f96 | 1807 | <varlistentry> |
287419c1 | 1808 | <term><command>exit <optional><replaceable>EXIT_CODE</replaceable></optional></command></term> |
27722f96 LN |
1809 | |
1810 | <listitem> | |
6324a8a7 LP |
1811 | <para>Ask the service manager to quit. This is only supported for user service managers (i.e. in |
1812 | conjunction with the <option>--user</option> option) or in containers and is equivalent to | |
1813 | <command>poweroff</command> otherwise. This command is asynchronous; it will return after the exit | |
1814 | operation is enqueued, without waiting for it to complete.</para> | |
1815 | ||
dcfaecc7 | 1816 | <para>The service manager will exit with the specified exit code, if |
6324a8a7 | 1817 | <replaceable>EXIT_CODE</replaceable> is passed.</para> |
27722f96 | 1818 | </listitem> |
b619ec8f | 1819 | </varlistentry> |
27722f96 | 1820 | |
b619ec8f LP |
1821 | <varlistentry> |
1822 | <term><command>switch-root <replaceable>ROOT</replaceable> <optional><replaceable>INIT</replaceable></optional></command></term> | |
1823 | ||
1824 | <listitem> | |
fb1bad9d LP |
1825 | <para>Switches to a different root directory and executes a new system manager process below it. This is |
1826 | intended for usage in initial RAM disks ("initrd"), and will transition from the initrd's system manager | |
1827 | process (a.k.a. "init" process) to the main system manager process which is loaded from the actual host | |
1828 | volume. This call takes two arguments: the directory that is to become the new root directory, and the path | |
1829 | to the new system manager binary below it to execute as PID 1. If the latter is omitted or the empty | |
1830 | string, a systemd binary will automatically be searched for and used as init. If the system manager path is | |
1831 | omitted, equal to the empty string or identical to the path to the systemd binary, the state of the | |
1832 | initrd's system manager process is passed to the main system manager, which allows later introspection of | |
1833 | the state of the services involved in the initrd boot phase.</para> | |
b619ec8f | 1834 | </listitem> |
27722f96 | 1835 | </varlistentry> |
b619ec8f | 1836 | |
27722f96 LN |
1837 | <varlistentry> |
1838 | <term><command>suspend</command></term> | |
1839 | ||
1840 | <listitem> | |
6324a8a7 LP |
1841 | <para>Suspend the system. This will trigger activation of the special target unit |
1842 | <filename>suspend.target</filename>. This command is asynchronous, and will return after the suspend | |
1843 | operation is successfully enqueued. It will not wait for the suspend/resume cycle to complete.</para> | |
27722f96 LN |
1844 | </listitem> |
1845 | </varlistentry> | |
b619ec8f | 1846 | |
27722f96 LN |
1847 | <varlistentry> |
1848 | <term><command>hibernate</command></term> | |
1849 | ||
1850 | <listitem> | |
6324a8a7 LP |
1851 | <para>Hibernate the system. This will trigger activation of the special target unit |
1852 | <filename>hibernate.target</filename>. This command is asynchronous, and will return after the hibernation | |
1853 | operation is successfully enqueued. It will not wait for the hibernate/thaw cycle to complete.</para> | |
27722f96 LN |
1854 | </listitem> |
1855 | </varlistentry> | |
b619ec8f | 1856 | |
27722f96 LN |
1857 | <varlistentry> |
1858 | <term><command>hybrid-sleep</command></term> | |
1859 | ||
1860 | <listitem> | |
6324a8a7 LP |
1861 | <para>Hibernate and suspend the system. This will trigger activation of the special target unit |
1862 | <filename>hybrid-sleep.target</filename>. This command is asynchronous, and will return after the hybrid | |
1863 | sleep operation is successfully enqueued. It will not wait for the sleep/wake-up cycle to complete.</para> | |
27722f96 LN |
1864 | </listitem> |
1865 | </varlistentry> | |
27722f96 LN |
1866 | </variablelist> |
1867 | </refsect2> | |
4a6022f0 | 1868 | |
a7c0e5d7 LP |
1869 | <refsect2> |
1870 | <title>Parameter Syntax</title> | |
1871 | ||
da25e029 | 1872 | <para>Unit commands listed above take either a single unit name (designated as <replaceable>NAME</replaceable>), |
1eecafb8 | 1873 | or multiple unit specifications (designated as <replaceable>PATTERN</replaceable>…). In the first case, the |
da25e029 ZJS |
1874 | unit name with or without a suffix must be given. If the suffix is not specified (unit name is "abbreviated"), |
1875 | systemctl will append a suitable suffix, <literal>.service</literal> by default, and a type-specific suffix in | |
1876 | case of commands which operate only on specific unit types. For example, | |
e3e0314b ZJS |
1877 | <programlisting># systemctl start sshd</programlisting> and |
1878 | <programlisting># systemctl start sshd.service</programlisting> | |
1879 | are equivalent, as are | |
507e28d8 | 1880 | <programlisting># systemctl isolate default</programlisting> |
e3e0314b | 1881 | and |
507e28d8 | 1882 | <programlisting># systemctl isolate default.target</programlisting> |
da25e029 ZJS |
1883 | Note that (absolute) paths to device nodes are automatically converted to device unit names, and other (absolute) |
1884 | paths to mount unit names. | |
e3e0314b ZJS |
1885 | <programlisting># systemctl status /dev/sda |
1886 | # systemctl status /home</programlisting> | |
1887 | are equivalent to: | |
1888 | <programlisting># systemctl status dev-sda.device | |
1889 | # systemctl status home.mount</programlisting> | |
2cdbbc9a | 1890 | In the second case, shell-style globs will be matched against the primary names of all units currently in memory; |
1f00eded LP |
1891 | literal unit names, with or without a suffix, will be treated as in the first case. This means that literal unit |
1892 | names always refer to exactly one unit, but globs may match zero units and this is not considered an | |
1893 | error.</para> | |
e3e0314b ZJS |
1894 | |
1895 | <para>Glob patterns use | |
decde8cd | 1896 | <citerefentry project='man-pages'><refentrytitle>fnmatch</refentrytitle><manvolnum>3</manvolnum></citerefentry>, |
e3e0314b ZJS |
1897 | so normal shell-style globbing rules are used, and |
1898 | <literal>*</literal>, <literal>?</literal>, | |
1899 | <literal>[]</literal> may be used. See | |
decde8cd | 1900 | <citerefentry project='man-pages'><refentrytitle>glob</refentrytitle><manvolnum>7</manvolnum></citerefentry> |
1f00eded | 1901 | for more details. The patterns are matched against the primary names of |
2cdbbc9a | 1902 | units currently in memory, and patterns which do not match anything |
e3e0314b ZJS |
1903 | are silently skipped. For example: |
1904 | <programlisting># systemctl stop sshd@*.service</programlisting> | |
1f00eded | 1905 | will stop all <filename>sshd@.service</filename> instances. Note that alias names of units, and units that aren't |
2cdbbc9a | 1906 | in memory are not considered for glob expansion. |
e3e0314b ZJS |
1907 | </para> |
1908 | ||
1534e170 LP |
1909 | <para>For unit file commands, the specified <replaceable>NAME</replaceable> should be the name of the unit file |
1910 | (possibly abbreviated, see above), or the absolute path to the unit file: | |
e3e0314b ZJS |
1911 | <programlisting># systemctl enable foo.service</programlisting> |
1912 | or | |
1913 | <programlisting># systemctl link /path/to/foo.service</programlisting> | |
1914 | </para> | |
a7c0e5d7 LP |
1915 | </refsect2> |
1916 | ||
4a6022f0 ZJS |
1917 | </refsect1> |
1918 | ||
1919 | <refsect1> | |
1920 | <title>Exit status</title> | |
1921 | ||
7b870f60 | 1922 | <para>On success, 0 is returned, a non-zero failure |
4a6022f0 ZJS |
1923 | code otherwise.</para> |
1924 | </refsect1> | |
1925 | ||
7d4fb3b1 RC |
1926 | <refsect1> |
1927 | <title>Environment</title> | |
1928 | ||
1929 | <variablelist class='environment-variables'> | |
1930 | <varlistentry> | |
1931 | <term><varname>$SYSTEMD_EDITOR</varname></term> | |
1932 | ||
1933 | <listitem><para>Editor to use when editing units; overrides | |
1934 | <varname>$EDITOR</varname> and <varname>$VISUAL</varname>. If neither | |
1935 | <varname>$SYSTEMD_EDITOR</varname> nor <varname>$EDITOR</varname> nor | |
1936 | <varname>$VISUAL</varname> are present or if it is set to an empty | |
1937 | string or if their execution failed, systemctl will try to execute well | |
1938 | known editors in this order: | |
9391a1c3 | 1939 | <citerefentry project='die-net'><refentrytitle>editor</refentrytitle><manvolnum>1</manvolnum></citerefentry>, |
3ba3a79d ZJS |
1940 | <citerefentry project='die-net'><refentrytitle>nano</refentrytitle><manvolnum>1</manvolnum></citerefentry>, |
1941 | <citerefentry project='die-net'><refentrytitle>vim</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
1942 | <citerefentry project='die-net'><refentrytitle>vi</refentrytitle><manvolnum>1</manvolnum></citerefentry>. | |
7d4fb3b1 RC |
1943 | </para></listitem> |
1944 | </varlistentry> | |
1945 | </variablelist> | |
1946 | <xi:include href="less-variables.xml" xpointer="pager"/> | |
1947 | <xi:include href="less-variables.xml" xpointer="less"/> | |
6e16066e | 1948 | <xi:include href="less-variables.xml" xpointer="lesscharset"/> |
7d4fb3b1 | 1949 | </refsect1> |
4a6022f0 ZJS |
1950 | |
1951 | <refsect1> | |
1952 | <title>See Also</title> | |
1953 | <para> | |
1954 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
4a6022f0 ZJS |
1955 | <citerefentry><refentrytitle>journalctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>, |
1956 | <citerefentry><refentrytitle>loginctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
a03fe1a5 | 1957 | <citerefentry><refentrytitle>machinectl</refentrytitle><manvolnum>1</manvolnum></citerefentry>, |
4a6022f0 | 1958 | <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>, |
ee41f602 | 1959 | <citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>, |
4a6022f0 | 1960 | <citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry>, |
5aded369 | 1961 | <citerefentry project='man-pages'><refentrytitle>wall</refentrytitle><manvolnum>1</manvolnum></citerefentry>, |
7d4fb3b1 | 1962 | <citerefentry><refentrytitle>systemd.preset</refentrytitle><manvolnum>5</manvolnum></citerefentry>, |
432d5965 | 1963 | <citerefentry><refentrytitle>systemd.generator</refentrytitle><manvolnum>7</manvolnum></citerefentry>, |
decde8cd | 1964 | <citerefentry project='man-pages'><refentrytitle>glob</refentrytitle><manvolnum>7</manvolnum></citerefentry> |
4a6022f0 ZJS |
1965 | </para> |
1966 | </refsect1> | |
7874bcd6 LP |
1967 | |
1968 | </refentry> |