1 <?xml version='1.0'?> <!--*-nxml-*-->
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
6 This file is part of systemd.
8 Copyright 2013 Zbigniew Jędrzejewski-Szmek
10 systemd is free software; you can redistribute it and/or modify it
11 under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
15 systemd is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
20 You should have received a copy of the GNU Lesser General Public License
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
24 <refentry id="systemd-run">
27 <title>systemd-run</title>
28 <productname>systemd</productname>
32 <contrib>Developer</contrib>
33 <firstname>Lennart</firstname>
34 <surname>Poettering</surname>
35 <email>lennart@poettering.net</email>
41 <refentrytitle>systemd-run</refentrytitle>
42 <manvolnum>1</manvolnum>
46 <refname>systemd-run</refname>
47 <refpurpose>Run programs in transient scope or service units</refpurpose>
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>
61 <title>Description</title>
63 <para><command>systemd-run</command> may be used create and start
64 a transient <filename>.service</filename> or a
65 <filename>.scope</filename> unit and run the specified
66 <replaceable>COMMAND</replaceable> in it.</para>
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>
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>
86 <title>Options</title>
88 <para>The following options are understood:</para>
92 <term><option>-h</option></term>
93 <term><option>--help</option></term>
95 <listitem><para>Prints a short help
96 text and exits.</para></listitem>
100 <term><option>--version</option></term>
102 <listitem><para>Prints a short version
103 string and exits.</para></listitem>
107 <term><option>--user</option></term>
110 <para>Talk to the service manager of the calling user,
111 rather than the service manager of the system.</para>
116 <term><option>--scope</option></term>
119 <para>Create a transient <filename>.scope</filename> unit instead of
120 the default transient <filename>.service</filename> unit.
126 <term><option>--unit=</option></term>
128 <listitem><para>Use this unit name instead of an automatically
129 generated one.</para></listitem>
133 <term><option>--description=</option></term>
135 <listitem><para>Provide description for the unit. If not
136 specified, the command itself will be used as a description.
137 See <varname>Description=</varname> in
138 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
143 <term><option>--slice=</option></term>
145 <listitem><para>Make the new <filename>.service</filename> or
146 <filename>.scope</filename> unit part of the specified slice,
147 instead of the <filename>system.slice</filename>.</para>
152 <term><option>--remain-after-exit</option></term>
154 <listitem><para>After the service's process has terminated, keep
155 the service around until it is explicitly stopped. This is
156 useful to collect runtime information about the service after
157 it finished running. Also see
158 <varname>RemainAfterExit=</varname> in
159 <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
165 <term><option>--send-sighup</option></term>
167 <listitem><para>When terminating the scope unit, send a SIGHUP
168 immediately after SIGTERM. This is useful to indicate to
169 shells and shell-like processes that the connection has been
170 severed. Also see <varname>SendSIGHUP=</varname> in
171 <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
177 <para>All command-line arguments after the first non-option
178 argument become part of the commandline of the launched
179 process. If a command is run as service unit, its first argument
180 needs to be an absolute binary path.</para>
184 <title>Exit status</title>
186 <para>On success, 0 is returned, a non-zero failure
187 code otherwise.</para>
191 <title>See Also</title>
193 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
194 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
195 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
196 <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
197 <citerefentry><refentrytitle>systemd.scope</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
198 <citerefentry><refentrytitle>systemd.slice</refentrytitle><manvolnum>5</manvolnum></citerefentry>.