]> git.proxmox.com Git - systemd.git/blob - man/systemd-run.html
bd17e0b8a6f6d2e75a22bdc8e48aa57ba07decb7
[systemd.git] / man / systemd-run.html
1 <html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>systemd-run</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><style>
2 a.headerlink {
3 color: #c60f0f;
4 font-size: 0.8em;
5 padding: 0 4px 0 4px;
6 text-decoration: none;
7 visibility: hidden;
8 }
9
10 a.headerlink:hover {
11 background-color: #c60f0f;
12 color: white;
13 }
14
15 h1:hover > a.headerlink, h2:hover > a.headerlink, h3:hover > a.headerlink, dt:hover > a.headerlink {
16 visibility: visible;
17 }
18 </style><a href="index.html">Index </a>·
19 <a href="systemd.directives.html">Directives </a>·
20 <a href="../python-systemd/index.html">Python </a>·
21 <a href="../libudev/index.html">libudev </a>·
22 <a href="../libudev/index.html">gudev </a><span style="float:right">systemd 208</span><hr><div class="refentry"><a name="systemd-run"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>systemd-run — Run programs in transient scope or service units</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="cmdsynopsis"><p><code class="command">systemd-run</code> [OPTIONS...] <em class="replaceable"><code>COMMAND</code></em>
23 [ARGS...]
24 </p></div></div><div class="refsect1"><a name="idm274675234000"></a><h2 id="Description">Description<a class="headerlink" title="Permalink to this headline" href="#Description"></a></h2><p><span class="command"><strong>systemd-run</strong></span> may be used create and start
25 a transient <code class="filename">.service</code> or a
26 <code class="filename">.scope</code> unit and run the specified
27 <em class="replaceable"><code>COMMAND</code></em> in it.</p><p>If a command is run as transient service unit, it will be
28 started and managed by the service manager like any other service,
29 and thus show up in the output of <span class="command"><strong>systemctl
30 list-units</strong></span> like any other unit. It will run in a clean
31 and detached execution environment. <span class="command"><strong>systemd-run</strong></span>
32 will start the service asynchronously in the background and
33 immediately return.</p><p>If a command is run as transient scope unit, it will be
34 started directly by <span class="command"><strong>systemd-run</strong></span> and thus
35 inherit the execution environment of the caller. It is however
36 managed by the service manager similar to normal services, and
37 will also show up in the output of <span class="command"><strong>systemctl
38 list-units</strong></span>. Execution in this case is synchronous, and
39 execution will return only when the command finishes.</p></div><div class="refsect1"><a name="idm274675226208"></a><h2 id="Options">Options<a class="headerlink" title="Permalink to this headline" href="#Options"></a></h2><p>The following options are understood:</p><div class="variablelist"><dl class="variablelist"><dt id="-h"><span class="term"><code class="option">-h</code>, </span><span class="term"><code class="option">--help</code></span><a class="headerlink" title="Permalink to this term" href="#-h"></a></dt><dd><p>Prints a short help
40 text and exits.</p></dd><dt id="--version"><span class="term"><code class="option">--version</code></span><a class="headerlink" title="Permalink to this term" href="#--version"></a></dt><dd><p>Prints a short version
41 string and exits.</p></dd><dt id="--user"><span class="term"><code class="option">--user</code></span><a class="headerlink" title="Permalink to this term" href="#--user"></a></dt><dd><p>Talk to the service manager of the calling user,
42 rather than the service manager of the system.</p></dd><dt id="--scope"><span class="term"><code class="option">--scope</code></span><a class="headerlink" title="Permalink to this term" href="#--scope"></a></dt><dd><p>Create a transient <code class="filename">.scope</code> unit instead of
43 the default transient <code class="filename">.service</code> unit.
44 </p></dd><dt id="--unit="><span class="term"><code class="option">--unit=</code></span><a class="headerlink" title="Permalink to this term" href="#--unit="></a></dt><dd><p>Use this unit name instead of an automatically
45 generated one.</p></dd><dt id="--description="><span class="term"><code class="option">--description=</code></span><a class="headerlink" title="Permalink to this term" href="#--description="></a></dt><dd><p>Provide description for the unit. If not
46 specified, the command itself will be used as a description.
47 See <code class="varname">Description=</code> in
48 <a href="systemd.unit.html"><span class="citerefentry"><span class="refentrytitle">systemd.unit</span>(5)</span></a>.
49 </p></dd><dt id="--slice="><span class="term"><code class="option">--slice=</code></span><a class="headerlink" title="Permalink to this term" href="#--slice="></a></dt><dd><p>Make the new <code class="filename">.service</code> or
50 <code class="filename">.scope</code> unit part of the specified slice,
51 instead of the <code class="filename">system.slice</code>.</p></dd><dt id="--remain-after-exit"><span class="term"><code class="option">--remain-after-exit</code></span><a class="headerlink" title="Permalink to this term" href="#--remain-after-exit"></a></dt><dd><p>After the service's process has terminated, keep
52 the service around until it is explicitly stopped. This is
53 useful to collect runtime information about the service after
54 it finished running. Also see
55 <code class="varname">RemainAfterExit=</code> in
56 <a href="systemd.service.html"><span class="citerefentry"><span class="refentrytitle">systemd.service</span>(5)</span></a>.
57 </p></dd><dt id="--send-sighup"><span class="term"><code class="option">--send-sighup</code></span><a class="headerlink" title="Permalink to this term" href="#--send-sighup"></a></dt><dd><p>When terminating the scope unit, send a SIGHUP
58 immediately after SIGTERM. This is useful to indicate to
59 shells and shell-like processes that the connection has been
60 severed. Also see <code class="varname">SendSIGHUP=</code> in
61 <a href="systemd.kill.html"><span class="citerefentry"><span class="refentrytitle">systemd.kill</span>(5)</span></a>.
62 </p></dd></dl></div><p>All command-line arguments after the first non-option
63 argument become part of the commandline of the launched
64 process. If a command is run as service unit, its first argument
65 needs to be an absolute binary path.</p></div><div class="refsect1"><a name="idm274679095552"></a><h2 id="Exit status">Exit status<a class="headerlink" title="Permalink to this headline" href="#Exit%20status"></a></h2><p>On success, 0 is returned, a non-zero failure
66 code otherwise.</p></div><div class="refsect1"><a name="idm274679094368"></a><h2 id="Example">Example<a class="headerlink" title="Permalink to this headline" href="#Example"></a></h2><p>The following command will log the environment variables
67 provided by systemd to services:</p><pre class="programlisting"># systemd-run env
68 Running as unit run-19945.service.
69 # journalctl -u run-19945.service
70 Sep 08 07:37:21 bupkis systemd[1]: Starting /usr/bin/env...
71 Sep 08 07:37:21 bupkis systemd[1]: Started /usr/bin/env.
72 Sep 08 07:37:21 bupkis env[19948]: PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
73 Sep 08 07:37:21 bupkis env[19948]: LANG=en_US.UTF-8
74 Sep 08 07:37:21 bupkis env[19948]: BOOT_IMAGE=/vmlinuz-3.11.0-0.rc5.git6.2.fc20.x86_64
75 </pre></div><div class="refsect1"><a name="idm274679091968"></a><h2 id="See Also">See Also<a class="headerlink" title="Permalink to this headline" href="#See%20Also"></a></h2><p>
76 <a href="systemd.html"><span class="citerefentry"><span class="refentrytitle">systemd</span>(1)</span></a>,
77 <a href="systemctl.html"><span class="citerefentry"><span class="refentrytitle">systemctl</span>(1)</span></a>,
78 <a href="systemd.unit.html"><span class="citerefentry"><span class="refentrytitle">systemd.unit</span>(5)</span></a>,
79 <a href="systemd.service.html"><span class="citerefentry"><span class="refentrytitle">systemd.service</span>(5)</span></a>,
80 <a href="systemd.scope.html"><span class="citerefentry"><span class="refentrytitle">systemd.scope</span>(5)</span></a>,
81 <a href="systemd.slice.html"><span class="citerefentry"><span class="refentrytitle">systemd.slice</span>(5)</span></a>.
82 </p></div></div></body></html>