]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/systemd-run.xml
build-sys: add conditionals and regenerate manpage list
[thirdparty/systemd.git] / man / systemd-run.xml
CommitLineData
f09114bc
ZJS
1<?xml version='1.0'?> <!--*-nxml-*-->
2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4
5<!--
6This file is part of systemd.
7
8Copyright 2013 Zbigniew Jędrzejewski-Szmek
9
10systemd is free software; you can redistribute it and/or modify it
11under the terms of the GNU Lesser General Public License as published by
12the Free Software Foundation; either version 2.1 of the License, or
13(at your option) any later version.
14
15systemd is distributed in the hope that it will be useful, but
16WITHOUT ANY WARRANTY; without even the implied warranty of
17MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18Lesser General Public License for more details.
19
20You should have received a copy of the GNU Lesser General Public License
21along with systemd; If not, see <http://www.gnu.org/licenses/>.
22-->
23
24<refentry id="systemd-run">
25
26 <refentryinfo>
27 <title>systemd-run</title>
28 <productname>systemd</productname>
29
30 <authorgroup>
31 <author>
32 <contrib>Developer</contrib>
33 <firstname>Lennart</firstname>
34 <surname>Poettering</surname>
35 <email>lennart@poettering.net</email>
36 </author>
37 </authorgroup>
38 </refentryinfo>
39
40 <refmeta>
41 <refentrytitle>systemd-run</refentrytitle>
42 <manvolnum>1</manvolnum>
43 </refmeta>
44
45 <refnamediv>
46 <refname>systemd-run</refname>
3803cde4 47 <refpurpose>Run programs in transient scope or service units</refpurpose>
f09114bc
ZJS
48 </refnamediv>
49
50 <refsynopsisdiv>
51 <cmdsynopsis>
52 <command>systemd-run</command>
53 <arg choice="opt" rep="repeat">OPTIONS</arg>
54 <arg choice="plain"><replaceable>COMMAND</replaceable>
55 <arg choice="opt" rep="repeat">ARGS</arg>
56 </arg>
57 </cmdsynopsis>
58 </refsynopsisdiv>
59
60 <refsect1>
61 <title>Description</title>
62
2614202b 63 <para><command>systemd-run</command> may be used to create and start
3803cde4
LP
64 a transient <filename>.service</filename> or a
65 <filename>.scope</filename> unit and run the specified
66 <replaceable>COMMAND</replaceable> in it.</para>
67
68 <para>If a command is run as transient service unit, it will be
69 started and managed by the service manager like any other service,
70 and thus show up in the output of <command>systemctl
71 list-units</command> like any other unit. It will run in a clean
72 and detached execution environment. <command>systemd-run</command>
73 will start the service asynchronously in the background and
74 immediately return.</para>
75
76 <para>If a command is run as transient scope unit, it will be
77 started directly by <command>systemd-run</command> and thus
78 inherit the execution environment of the caller. It is however
79 managed by the service manager similar to normal services, and
80 will also show up in the output of <command>systemctl
81 list-units</command>. Execution in this case is synchronous, and
82 execution will return only when the command finishes.</para>
f09114bc
ZJS
83 </refsect1>
84
85 <refsect1>
86 <title>Options</title>
87
88 <para>The following options are understood:</para>
89
90 <variablelist>
91 <varlistentry>
92 <term><option>-h</option></term>
93 <term><option>--help</option></term>
94
95 <listitem><para>Prints a short help
96 text and exits.</para></listitem>
97 </varlistentry>
98
99 <varlistentry>
100 <term><option>--version</option></term>
101
102 <listitem><para>Prints a short version
103 string and exits.</para></listitem>
104 </varlistentry>
105
106 <varlistentry>
107 <term><option>--user</option></term>
108
109 <listitem>
3803cde4
LP
110 <para>Talk to the service manager of the calling user,
111 rather than the service manager of the system.</para>
f09114bc
ZJS
112 </listitem>
113 </varlistentry>
114
66b1e746
LP
115 <varlistentry>
116 <term><option>--system</option></term>
117
118 <listitem>
119 <para>Talk to the service manager of the system. This is the
120 implied default.</para>
121 </listitem>
122 </varlistentry>
123
d21ed1ea
LP
124 <varlistentry>
125 <term><option>-H</option></term>
126 <term><option>--host=</option></term>
127
63ba209d 128 <listitem><para>Execute the operation
d21ed1ea
LP
129 remotely. Specify a hostname, or
130 username and hostname separated by <literal>@</literal>,
131 to connect to. This will use SSH to
132 talk to the remote machine manager
133 instance.</para></listitem>
134 </varlistentry>
135
136 <varlistentry>
137 <term><option>-M</option></term>
138 <term><option>--machine=</option></term>
139
63ba209d 140 <listitem><para>Execute the operation on a
d21ed1ea
LP
141 local container. Specify a container
142 name to connect to.</para></listitem>
143 </varlistentry>
144
f09114bc
ZJS
145 <varlistentry>
146 <term><option>--scope</option></term>
147
148 <listitem>
3803cde4 149 <para>Create a transient <filename>.scope</filename> unit instead of
f09114bc
ZJS
150 the default transient <filename>.service</filename> unit.
151 </para>
152 </listitem>
153 </varlistentry>
154
155 <varlistentry>
156 <term><option>--unit=</option></term>
157
158 <listitem><para>Use this unit name instead of an automatically
159 generated one.</para></listitem>
160 </varlistentry>
161
162 <varlistentry>
163 <term><option>--description=</option></term>
164
165 <listitem><para>Provide description for the unit. If not
166 specified, the command itself will be used as a description.
167 See <varname>Description=</varname> in
168 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
169 </para></listitem>
170 </varlistentry>
171
172 <varlistentry>
173 <term><option>--slice=</option></term>
174
175 <listitem><para>Make the new <filename>.service</filename> or
176 <filename>.scope</filename> unit part of the specified slice,
177 instead of the <filename>system.slice</filename>.</para>
178 </listitem>
179 </varlistentry>
6577c7ce
LP
180
181 <varlistentry>
182 <term><option>--remain-after-exit</option></term>
183
d6ee7fa2 184 <listitem><para>After the service's process has terminated, keep
6577c7ce
LP
185 the service around until it is explicitly stopped. This is
186 useful to collect runtime information about the service after
187 it finished running. Also see
188 <varname>RemainAfterExit=</varname> in
189 <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
190 </para>
191 </listitem>
192 </varlistentry>
a6c0353b
LP
193
194 <varlistentry>
195 <term><option>--send-sighup</option></term>
196
d6ee7fa2 197 <listitem><para>When terminating the scope unit, send a SIGHUP
a6c0353b
LP
198 immediately after SIGTERM. This is useful to indicate to
199 shells and shell-like processes that the connection has been
d6ee7fa2 200 severed. Also see <varname>SendSIGHUP=</varname> in
a6c0353b
LP
201 <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
202 </para>
203 </listitem>
204 </varlistentry>
f09114bc
ZJS
205 </variablelist>
206
207 <para>All command-line arguments after the first non-option
208 argument become part of the commandline of the launched
fbce1139 209 process. If a command is run as service unit, its first argument
3803cde4 210 needs to be an absolute binary path.</para>
f09114bc
ZJS
211 </refsect1>
212
213 <refsect1>
214 <title>Exit status</title>
215
216 <para>On success, 0 is returned, a non-zero failure
217 code otherwise.</para>
218 </refsect1>
219
c9d954b2
ZJS
220 <refsect1>
221 <title>Example</title>
222
223 <para>The following command will log the environment variables
224 provided by systemd to services:</para>
225
226 <programlisting># systemd-run env
227Running as unit run-19945.service.
228# journalctl -u run-19945.service
229Sep 08 07:37:21 bupkis systemd[1]: Starting /usr/bin/env...
230Sep 08 07:37:21 bupkis systemd[1]: Started /usr/bin/env.
231Sep 08 07:37:21 bupkis env[19948]: PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
232Sep 08 07:37:21 bupkis env[19948]: LANG=en_US.UTF-8
9fccdb0f 233Sep 08 07:37:21 bupkis env[19948]: BOOT_IMAGE=/vmlinuz-3.11.0-0.rc5.git6.2.fc20.x86_64</programlisting>
c9d954b2
ZJS
234 </refsect1>
235
f09114bc
ZJS
236 <refsect1>
237 <title>See Also</title>
238 <para>
239 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
3803cde4 240 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
f09114bc
ZJS
241 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
242 <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
243 <citerefentry><refentrytitle>systemd.scope</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
d21ed1ea
LP
244 <citerefentry><refentrytitle>systemd.slice</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
245 <citerefentry><refentrytitle>machinectl</refentrytitle><manvolnum>1</manvolnum></citerefentry>
f09114bc
ZJS
246 </para>
247 </refsect1>
248
249</refentry>