]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/systemd-run.xml
Merge pull request #8066 from LittleCVR/udevadm-trigger-and-settle
[thirdparty/systemd.git] / man / systemd-run.xml
CommitLineData
3802a3d3 1<?xml version='1.0'?> <!--*- Mode: nxml; nxml-child-indent: 2; indent-tabs-mode: nil -*-->
f09114bc 2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
12b42c76 3"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
f09114bc
ZJS
4
5<!--
572eb058
ZJS
6 SPDX-License-Identifier: LGPL-2.1+
7
b975b0d5 8 This file is part of systemd.
f09114bc 9
b975b0d5 10 Copyright 2013 Zbigniew Jędrzejewski-Szmek
f09114bc 11
b975b0d5
ZJS
12 systemd is free software; you can redistribute it and/or modify it
13 under the terms of the GNU Lesser General Public License as published by
14 the Free Software Foundation; either version 2.1 of the License, or
15 (at your option) any later version.
f09114bc 16
b975b0d5
ZJS
17 systemd is distributed in the hope that it will be useful, but
18 WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 Lesser General Public License for more details.
f09114bc 21
b975b0d5
ZJS
22 You should have received a copy of the GNU Lesser General Public License
23 along with systemd; If not, see <http://www.gnu.org/licenses/>.
f09114bc
ZJS
24-->
25
dfdebb1b
ZJS
26<refentry id="systemd-run"
27 xmlns:xi="http://www.w3.org/2001/XInclude">
f09114bc
ZJS
28
29 <refentryinfo>
30 <title>systemd-run</title>
31 <productname>systemd</productname>
32
33 <authorgroup>
34 <author>
35 <contrib>Developer</contrib>
36 <firstname>Lennart</firstname>
37 <surname>Poettering</surname>
38 <email>lennart@poettering.net</email>
39 </author>
40 </authorgroup>
41 </refentryinfo>
42
43 <refmeta>
44 <refentrytitle>systemd-run</refentrytitle>
45 <manvolnum>1</manvolnum>
46 </refmeta>
47
48 <refnamediv>
49 <refname>systemd-run</refname>
624dd009 50 <refpurpose>Run programs in transient scope units, service units, or path-, socket-, or timer-triggered service units</refpurpose>
f09114bc
ZJS
51 </refnamediv>
52
53 <refsynopsisdiv>
54 <cmdsynopsis>
55 <command>systemd-run</command>
56 <arg choice="opt" rep="repeat">OPTIONS</arg>
57 <arg choice="plain"><replaceable>COMMAND</replaceable>
58 <arg choice="opt" rep="repeat">ARGS</arg>
59 </arg>
60 </cmdsynopsis>
624dd009
YW
61 <cmdsynopsis>
62 <command>systemd-run</command>
63 <arg choice="opt" rep="repeat">OPTIONS</arg>
64 <arg choice="opt" rep="repeat">PATH OPTIONS</arg>
65 <arg choice="req"><replaceable>COMMAND</replaceable></arg>
66 <arg choice="opt" rep="repeat">ARGS</arg>
67 </cmdsynopsis>
68 <cmdsynopsis>
69 <command>systemd-run</command>
70 <arg choice="opt" rep="repeat">OPTIONS</arg>
71 <arg choice="opt" rep="repeat">SOCKET OPTIONS</arg>
72 <arg choice="req"><replaceable>COMMAND</replaceable></arg>
73 <arg choice="opt" rep="repeat">ARGS</arg>
74 </cmdsynopsis>
4c213d6c
WC
75 <cmdsynopsis>
76 <command>systemd-run</command>
77 <arg choice="opt" rep="repeat">OPTIONS</arg>
78 <arg choice="opt" rep="repeat">TIMER OPTIONS</arg>
79 <arg choice="req"><replaceable>COMMAND</replaceable></arg>
80 <arg choice="opt" rep="repeat">ARGS</arg>
81 </cmdsynopsis>
f09114bc
ZJS
82 </refsynopsisdiv>
83
84 <refsect1>
85 <title>Description</title>
86
014c4c98
LP
87 <para><command>systemd-run</command> may be used to create and start a transient <filename>.service</filename> or
88 <filename>.scope</filename> unit and run the specified <replaceable>COMMAND</replaceable> in it. It may also be
624dd009
YW
89 used to create and start a transient <filename>.path</filename>, <filename>.socket</filename>, or
90 <filename>.timer</filename> unit, that activates a <filename>.service</filename> unit when elapsing.</para>
014c4c98
LP
91
92 <para>If a command is run as transient service unit, it will be started and managed by the service manager like any
93 other service, and thus shows up in the output of <command>systemctl list-units</command> like any other unit. It
94 will run in a clean and detached execution environment, with the service manager as its parent process. In this
95 mode, <command>systemd-run</command> will start the service asynchronously in the background and return after the
b03ec009 96 command has begun execution (unless <option>--no-block</option> or <option>--wait</option> are specified, see
014c4c98
LP
97 below).</para>
98
99 <para>If a command is run as transient scope unit, it will be executed by <command>systemd-run</command> itself as
100 parent process and will thus inherit the execution environment of the caller. However, the processes of the command
101 are managed by the service manager similar to normal services, and will show up in the output of <command>systemctl
102 list-units</command>. Execution in this case is synchronous, and will return only when the command finishes. This
103 mode is enabled via the <option>--scope</option> switch (see below). </para>
104
624dd009
YW
105 <para>If a command is run with path, socket, or timer options such as <option>--on-calendar=</option> (see below),
106 a transient path, socket, or timer unit is created alongside the service unit for the specified command. Only the
107 transient path, socket, or timer unit is started immediately, the transient service unit will be triggered by the
108 path, socket, or timer unit. If the <option>--unit=</option> option is specified, the
109 <replaceable>COMMAND</replaceable> may be omitted. In this case, <command>systemd-run</command> creates only a
110 <filename>.path</filename>, <filename>.socket</filename>, or <filename>.timer</filename> unit that triggers the
111 specified unit.</para>
f09114bc
ZJS
112 </refsect1>
113
114 <refsect1>
115 <title>Options</title>
116
117 <para>The following options are understood:</para>
118
119 <variablelist>
8c7db2fb
EV
120 <varlistentry>
121 <term><option>--no-ask-password</option></term>
122
123 <listitem><para>Do not query the user for authentication for
124 privileged operations.</para></listitem>
125 </varlistentry>
126
f09114bc
ZJS
127 <varlistentry>
128 <term><option>--scope</option></term>
129
130 <listitem>
014c4c98
LP
131 <para>Create a transient <filename>.scope</filename> unit instead of the default transient
132 <filename>.service</filename> unit (see above).
f09114bc
ZJS
133 </para>
134 </listitem>
135 </varlistentry>
136
137 <varlistentry>
138 <term><option>--unit=</option></term>
139
140 <listitem><para>Use this unit name instead of an automatically
141 generated one.</para></listitem>
142 </varlistentry>
143
df31a6c0
LP
144 <varlistentry>
145 <term><option>--property=</option></term>
146 <term><option>-p</option></term>
147
014c4c98
LP
148 <listitem><para>Sets a property on the scope or service unit that is created. This option takes an assignment
149 in the same format as
df31a6c0
LP
150 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>'s
151 <command>set-property</command> command.</para>
152 </listitem>
153 </varlistentry>
154
f09114bc
ZJS
155 <varlistentry>
156 <term><option>--description=</option></term>
157
624dd009
YW
158 <listitem><para>Provide a description for the service, scope, path, socket, or timer unit. If not specified,
159 the command itself will be used as a description. See <varname>Description=</varname> in
f09114bc
ZJS
160 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
161 </para></listitem>
162 </varlistentry>
163
164 <varlistentry>
165 <term><option>--slice=</option></term>
166
014c4c98
LP
167 <listitem><para>Make the new <filename>.service</filename> or <filename>.scope</filename> unit part of the
168 specified slice, instead of <filename>system.slice</filename>.</para>
f09114bc
ZJS
169 </listitem>
170 </varlistentry>
6577c7ce
LP
171
172 <varlistentry>
a953b31a 173 <term><option>-r</option></term>
6577c7ce
LP
174 <term><option>--remain-after-exit</option></term>
175
014c4c98
LP
176 <listitem><para>After the service process has terminated, keep the service around until it is explicitly
177 stopped. This is useful to collect runtime information about the service after it finished running. Also see
6577c7ce
LP
178 <varname>RemainAfterExit=</varname> in
179 <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
180 </para>
181 </listitem>
182 </varlistentry>
a6c0353b
LP
183
184 <varlistentry>
185 <term><option>--send-sighup</option></term>
186
014c4c98
LP
187 <listitem><para>When terminating the scope or service unit, send a SIGHUP immediately after SIGTERM. This is
188 useful to indicate to shells and shell-like processes that the connection has been severed. Also see
981ee551 189 <varname>SendSIGHUP=</varname> in
a6c0353b
LP
190 <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
191 </para>
192 </listitem>
193 </varlistentry>
dfdebb1b 194
981ee551
LP
195 <varlistentry>
196 <term><option>--service-type=</option></term>
197
198 <listitem><para>Sets the service type. Also see
199 <varname>Type=</varname> in
200 <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>. This
201 option has no effect in conjunction with
202 <option>--scope</option>. Defaults to
203 <constant>simple</constant>.</para>
204 </listitem>
205 </varlistentry>
206
207 <varlistentry>
208 <term><option>--uid=</option></term>
209 <term><option>--gid=</option></term>
210
014c4c98
LP
211 <listitem><para>Runs the service process under the specified UNIX user and group. Also see
212 <varname>User=</varname> and <varname>Group=</varname> in
4de33e7f 213 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
981ee551
LP
214 </listitem>
215 </varlistentry>
216
217 <varlistentry>
218 <term><option>--nice=</option></term>
219
220 <listitem><para>Runs the service process with the specified
221 nice level. Also see <varname>Nice=</varname> in
4de33e7f 222 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
981ee551
LP
223 </listitem>
224 </varlistentry>
225
226 <varlistentry>
b5911366
ZJS
227 <term><option>-E <replaceable>NAME</replaceable>=<replaceable>VALUE</replaceable></option></term>
228 <term><option>--setenv=<replaceable>NAME</replaceable>=<replaceable>VALUE</replaceable></option></term>
981ee551 229
b5911366
ZJS
230 <listitem><para>Runs the service process with the specified environment variable set.
231 Also see <varname>Environment=</varname> in
4de33e7f 232 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
981ee551
LP
233 </listitem>
234 </varlistentry>
235
9b15b784
LP
236 <varlistentry>
237 <term><option>--pty</option></term>
238 <term><option>-t</option></term>
239
5dca7739
LP
240 <listitem><para>When invoking the command, the transient service connects its standard input, output and error
241 to the terminal <command>systemd-run</command> is invoked on, via a pseudo TTY device. This allows running
156d6036 242 programs that expect interactive user input/output as services, such as interactive command shells.</para>
7f129a1f
LP
243
244 <para>Note that
245 <citerefentry><refentrytitle>machinectl</refentrytitle><manvolnum>1</manvolnum></citerefentry>'s
246 <command>shell</command> command is usually a better alternative for requesting a new, interactive login
5dca7739
LP
247 session on the local host or a local container.</para>
248
249 <para>See below for details on how this switch combines with <option>--pipe</option>.</para></listitem>
250 </varlistentry>
251
252 <varlistentry>
253 <term><option>--pipe</option></term>
254 <term><option>-P</option></term>
255
256 <listitem><para>If specified, standard input, output, and error of the transient service are inherited from the
156d6036
ZJS
257 <command>systemd-run</command> command itself. This allows <command>systemd-run</command>
258 to be used within shell pipelines.
259 Note that this mode is not suitable for interactive command shells and similar, as the
960d20e1 260 service process will not become a TTY controller when invoked on a terminal. Use <option>--pty</option> instead
5dca7739
LP
261 in that case.</para>
262
263 <para>When both <option>--pipe</option> and <option>--pty</option> are used in combination the more appropriate
264 option is automatically determined and used. Specifically, when invoked with standard input, output and error
b0e8cec2
LP
265 connected to a TTY <option>--pty</option> is used, and otherwise <option>--pipe</option>.</para>
266
267 <para>When this option is used the original file descriptors <command>systemd-run</command> receives are passed
268 to the service processes as-is. If the service runs with different privileges than
269 <command>systemd-run</command>, this means the service might not be able to re-open the passed file
270 descriptors, due to normal file descriptor access restrictions. If the invoked process is a shell script that
271 uses the <command>echo "hello" > /dev/stderr</command> construct for writing messages to stderr, this might
272 cause problems, as this only works if stderr can be re-opened. To mitigate this use the construct <command>echo
273 "hello" >&amp;2</command> instead, which is mostly equivalent and avoids this pitfall.</para></listitem>
9b15b784 274 </varlistentry>
88ae7333 275
095dc596
LP
276 <varlistentry>
277 <term><option>--quiet</option></term>
278 <term><option>-q</option></term>
279
280 <listitem><para>Suppresses additional informational output
281 while running. This is particularly useful in combination with
282 <option>--pty</option> when it will suppress the initial
283 message explaining how to terminate the TTY connection.</para></listitem>
284 </varlistentry>
285
4c213d6c
WC
286 <varlistentry>
287 <term><option>--on-active=</option></term>
288 <term><option>--on-boot=</option></term>
289 <term><option>--on-startup=</option></term>
290 <term><option>--on-unit-active=</option></term>
291 <term><option>--on-unit-inactive=</option></term>
292
014c4c98
LP
293 <listitem><para>Defines a monotonic timer relative to different starting points for starting the specified
294 command. See <varname>OnActiveSec=</varname>, <varname>OnBootSec=</varname>, <varname>OnStartupSec=</varname>,
295 <varname>OnUnitActiveSec=</varname> and <varname>OnUnitInactiveSec=</varname> in
296 <citerefentry><refentrytitle>systemd.timer</refentrytitle><manvolnum>5</manvolnum></citerefentry> for
624dd009
YW
297 details. These options are shortcuts for <command>--timer-property=</command> with the relevant properties.
298 These options may not be combined with <option>--scope</option> or <option>--pty</option>.</para>
4c213d6c
WC
299 </listitem>
300 </varlistentry>
301
302 <varlistentry>
303 <term><option>--on-calendar=</option></term>
304
014c4c98
LP
305 <listitem><para>Defines a calendar timer for starting the specified command. See <varname>OnCalendar=</varname>
306 in <citerefentry><refentrytitle>systemd.timer</refentrytitle><manvolnum>5</manvolnum></citerefentry>. This
624dd009
YW
307 option is a shortcut for <command>--timer-property=OnCalendar=</command>. This option may not be combined with
308 <option>--scope</option> or <option>--pty</option>.</para>
4c213d6c
WC
309 </listitem>
310 </varlistentry>
311
312 <varlistentry>
624dd009
YW
313 <term><option>--path-property=</option></term>
314 <term><option>--socket-property=</option></term>
4c213d6c
WC
315 <term><option>--timer-property=</option></term>
316
624dd009
YW
317 <listitem><para>Sets a property on the path, socket, or timer unit that is created. This option is similar to
318 <option>--property=</option> but applies to the transient path, socket, or timer unit rather than the
319 transient service unit created. This option takes an assignment in the same format as
320 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>'s
321 <command>set-property</command> command. These options may not be combined with
322 <option>--scope</option> or <option>--pty</option>.</para>
323 </listitem>
4c213d6c
WC
324 </varlistentry>
325
3d161f99
LP
326 <varlistentry>
327 <term><option>--no-block</option></term>
328
329 <listitem>
014c4c98
LP
330 <para>Do not synchronously wait for the unit start operation to finish. If this option is not specified, the
331 start request for the transient unit will be verified, enqueued and <command>systemd-run</command> will wait
332 until the unit's start-up is completed. By passing this argument, it is only verified and enqueued. This
333 option may not be combined with <option>--wait</option>.</para>
3d161f99
LP
334 </listitem>
335 </varlistentry>
336
014c4c98
LP
337 <varlistentry>
338 <term><option>--wait</option></term>
339
340 <listitem><para>Synchronously wait for the transient service to terminate. If this option is specified, the
341 start request for the transient unit is verified, enqueued, and waited for. Subsequently the invoked unit is
342 monitored, and it is waited until it is deactivated again (most likely because the specified command
343 completed). On exit, terse information about the unit's runtime is shown, including total runtime (as well as
344 CPU usage, if <option>--property=CPUAccounting=1</option> was set) and the exit code and status of the main
345 process. This output may be suppressed with <option>--quiet</option>. This option may not be combined with
624dd009 346 <option>--no-block</option>, <option>--scope</option> or the various path, socket, or timer options.</para></listitem>
014c4c98
LP
347 </varlistentry>
348
fe9d0be9
LP
349 <varlistentry>
350 <term><option>-G</option></term>
351 <term><option>--collect</option></term>
352
353 <listitem><para>Unload the transient unit after it completed, even if it failed. Normally, without this option,
354 all units that ran and failed are kept in memory until the user explicitly resets their failure state with
355 <command>systemctl reset-failed</command> or an equivalent command. On the other hand, units that ran
356 successfully are unloaded immediately. If this option is turned on the "garbage collection" of units is more
357 aggressive, and unloads units regardless if they exited successfully or failed. This option is a shortcut for
358 <command>--property=CollectMode=inactive-or-failed</command>, see the explanation for
359 <varname>CollectMode=</varname> in
360 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry> for further
361 information.</para></listitem>
362 </varlistentry>
363
9b15b784
LP
364 <xi:include href="user-system-options.xml" xpointer="user" />
365 <xi:include href="user-system-options.xml" xpointer="system" />
366 <xi:include href="user-system-options.xml" xpointer="host" />
367 <xi:include href="user-system-options.xml" xpointer="machine" />
368
dfdebb1b
ZJS
369 <xi:include href="standard-options.xml" xpointer="help" />
370 <xi:include href="standard-options.xml" xpointer="version" />
f09114bc
ZJS
371 </variablelist>
372
81c7dd89 373 <para>All command line arguments after the first non-option
3f85ef0f 374 argument become part of the command line of the launched
3f2d1365
AJ
375 process. If a command is run as service unit, the first argument
376 needs to be an absolute program path.</para>
f09114bc
ZJS
377 </refsect1>
378
379 <refsect1>
380 <title>Exit status</title>
381
382 <para>On success, 0 is returned, a non-zero failure
383 code otherwise.</para>
384 </refsect1>
385
c9d954b2 386 <refsect1>
df31a6c0 387 <title>Examples</title>
c9d954b2 388
4eac7f5c
ZJS
389 <example>
390 <title>Logging environment variables provided by systemd to services</title>
c9d954b2 391
4eac7f5c 392 <programlisting># systemd-run env
f3ea87af 393Running as unit: run-19945.service
c9d954b2
ZJS
394# journalctl -u run-19945.service
395Sep 08 07:37:21 bupkis systemd[1]: Starting /usr/bin/env...
396Sep 08 07:37:21 bupkis systemd[1]: Started /usr/bin/env.
397Sep 08 07:37:21 bupkis env[19948]: PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
398Sep 08 07:37:21 bupkis env[19948]: LANG=en_US.UTF-8
9fccdb0f 399Sep 08 07:37:21 bupkis env[19948]: BOOT_IMAGE=/vmlinuz-3.11.0-0.rc5.git6.2.fc20.x86_64</programlisting>
4eac7f5c 400 </example>
df31a6c0 401
4eac7f5c
ZJS
402 <example>
403 <title>Limiting resources available to a command</title>
df31a6c0 404
4eac7f5c 405 <programlisting># systemd-run -p BlockIOWeight=10 updatedb</programlisting>
4c213d6c 406
4eac7f5c
ZJS
407 <para>This command invokes the
408 <citerefentry project='man-pages'><refentrytitle>updatedb</refentrytitle><manvolnum>8</manvolnum></citerefentry>
409 tool, but lowers the block I/O weight for it to 10. See
410 <citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>
411 for more information on the <varname>BlockIOWeight=</varname>
412 property.</para>
413 </example>
4c213d6c 414
4eac7f5c
ZJS
415 <example>
416 <title>Running commands at a specified time</title>
417
418 <para>The following command will touch a file after 30 seconds.</para>
419
420 <programlisting># date; systemd-run --on-active=30 --timer-property=AccuracySec=100ms /bin/touch /tmp/foo
4c213d6c 421Mon Dec 8 20:44:24 KST 2014
f3ea87af
ILG
422Running as unit: run-71.timer
423Will run service as unit: run-71.service
85fb8031 424# journalctl -b -u run-71.timer
4c213d6c
WC
425-- Logs begin at Fri 2014-12-05 19:09:21 KST, end at Mon 2014-12-08 20:44:54 KST. --
426Dec 08 20:44:38 container systemd[1]: Starting /bin/touch /tmp/foo.
427Dec 08 20:44:38 container systemd[1]: Started /bin/touch /tmp/foo.
85fb8031 428# journalctl -b -u run-71.service
4c213d6c
WC
429-- Logs begin at Fri 2014-12-05 19:09:21 KST, end at Mon 2014-12-08 20:44:54 KST. --
430Dec 08 20:44:48 container systemd[1]: Starting /bin/touch /tmp/foo...
431Dec 08 20:44:48 container systemd[1]: Started /bin/touch /tmp/foo.</programlisting>
4eac7f5c 432 </example>
9b15b784 433
4eac7f5c
ZJS
434 <example>
435 <title>Allowing access to the tty</title>
9b15b784 436
4eac7f5c
ZJS
437 <para>The following command invokes <filename>/bin/bash</filename> as a service
438 passing its standard input, output and error to the calling TTY.</para>
9b15b784 439
4eac7f5c
ZJS
440 <programlisting># systemd-run -t --send-sighup /bin/bash</programlisting>
441 </example>
65eb37f8
ZJS
442
443 <example>
444 <title>Start <command>screen</command> as a user service</title>
445
446 <programlisting>$ systemd-run --scope --user screen
447Running scope as unit run-r14b0047ab6df45bfb45e7786cc839e76.scope.
448
449$ screen -ls
450There is a screen on:
451 492..laptop (Detached)
4521 Socket in /var/run/screen/S-fatima.
453</programlisting>
454
455 <para>This starts the <command>screen</command> process as a child of the
456 <command>systemd --user</command> process that was started by
457 <filename>user@.service</filename>, in a scope unit. A
458 <citerefentry><refentrytitle>systemd.scope</refentrytitle><manvolnum>5</manvolnum></citerefentry>
459 unit is used instead of a
460 <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>
461 unit, because <command>screen</command> will exit when detaching from the terminal,
462 and a service unit would be terminated. Running <command>screen</command>
463 as a user unit has the advantage that it is not part of the session scope.
464 If <varname>KillUserProcesses=yes</varname> is configured in
465 <citerefentry><refentrytitle>logind.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
466 the default, the session scope will be terminated when the user logs
467 out of that session.</para>
468
469 <para>The <filename>user@.service</filename> is started automatically
470 when the user first logs in, and stays around as long as at least one
471 login session is open. After the user logs out of the last session,
472 <filename>user@.service</filename> and all services underneath it
2dd67817 473 are terminated. This behavior is the default, when "lingering" is
65eb37f8
ZJS
474 not enabled for that user. Enabling lingering means that
475 <filename>user@.service</filename> is started automatically during
476 boot, even if the user is not logged in, and that the service is
477 not terminated when the user logs out.</para>
478
479 <para>Enabling lingering allows the user to run processes without being logged in,
480 for example to allow <command>screen</command> to persist after the user logs out,
481 even if the session scope is terminated. In the default configuration, users can
482 enable lingering for themselves:</para>
483
484 <programlisting>$ loginctl enable-linger</programlisting>
485 </example>
c9d954b2
ZJS
486 </refsect1>
487
f09114bc
ZJS
488 <refsect1>
489 <title>See Also</title>
490 <para>
491 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
3803cde4 492 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
f09114bc
ZJS
493 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
494 <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
495 <citerefentry><refentrytitle>systemd.scope</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
d21ed1ea 496 <citerefentry><refentrytitle>systemd.slice</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
df31a6c0
LP
497 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
498 <citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
4c213d6c 499 <citerefentry><refentrytitle>systemd.timer</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
450442cf 500 <citerefentry><refentrytitle>systemd-mount</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
d21ed1ea 501 <citerefentry><refentrytitle>machinectl</refentrytitle><manvolnum>1</manvolnum></citerefentry>
f09114bc
ZJS
502 </para>
503 </refsect1>
504
505</refentry>