]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
man: document that "systemd-run -M" propagates exit codes, and "machinectl shell... 4975/head
authorLennart Poettering <lennart@poettering.net>
Sat, 24 Dec 2016 00:08:15 +0000 (01:08 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 27 Dec 2016 17:32:45 +0000 (18:32 +0100)
This adds a brief explanation, suggesting the use of "systemd-run -M" to
acquire exit status/code information for the invoked process.

My original plan was to propagate the exit code/status in "machinectl
shell" too, but this would mean we'd have to actively watch the shell's
runtime status, and thus would need full, highly privileged and
continious access to the container's system manager, the way
"systemd-run" does it. This would be quite a departure from the
simplistic, low-priviliged OpenShell() bus call implementation of the
current code, that really just acquires a PTY device with a shell
connected.

Moreover it would blur the lines between the two commands even further,
which I think is not desirable. Hence, from now on:

    "machinectl shell" is the full-session, interactive shell for human
    users

    "systemd-run -M …" is the low-level tool, that supports
    on-interactive mode, and is more configurable and suitable for
    streaming.

Fixes: #4215
man/machinectl.xml
man/systemd-run.xml

index 8bebdcf9a136ad88cea61a16d254f7858ea260cc..38cf919a78f4542d0242966118add5b4cc716eb9 100644 (file)
         user may be selected. Use <option>--setenv=</option> to set
         environment variables for the executed process.</para>
 
+        <para>Note that <command>machinectl shell</command> does not propagate the exit code/status of the invoked
+        shell process. Use <command>systemd-run</command> instead if that information is required (see below).</para>
+
         <para>When using the <command>shell</command> command without
         arguments, (thus invoking the executed shell or command on the
         local host), it is in many ways similar to a <citerefentry
         environment variables or resource limits, among other
         properties.</para>
 
-        <para>Note that
-        <citerefentry><refentrytitle>systemd-run</refentrytitle><manvolnum>1</manvolnum></citerefentry>
-        may be used in place of the <command>shell</command> command,
-        and allows more detailed, low-level configuration of the
-        invoked unit. However, it is frequently more privileged than
-        the <command>shell</command> command.</para></listitem>
+        <para>Note that <citerefentry><refentrytitle>systemd-run</refentrytitle><manvolnum>1</manvolnum></citerefentry>
+        with its <option>--machine=</option> switch may be used in place of the <command>machinectl shell</command>
+        command, and allows non-interactive operation, more detailed and low-level configuration of the invoked unit,
+        as well as access to runtime and exit code/status information of the invoked shell process. In particular, use
+        <command>systemd-run</command>'s <option>--wait</option> switch to propagate exit status information of the
+        invoked process. Use <command>systemd-run</command>'s <option>--pty</option> switch for acquiring an
+        interactive shell, similar to <command>machinectl shell</command>. In general, <command>systemd-run</command>
+        is preferable for scripting purposes. However, note that <command>systemd-run</command> might require higher
+        privileges than <command>machinectl shell</command>.</para></listitem>
       </varlistentry>
 
       <varlistentry>
index 2ad8cb0835b8c9bbee8e42153aa1325e066176b0..8d881f15d6eb732b92433b629ceccef637424593 100644 (file)
 
         <listitem><para>When invoking the command, the transient service connects its standard input and output to the
         terminal <command>systemd-run</command> is invoked on, via a pseudo TTY device. This allows running binaries
-        that expect interactive user input as services, such as interactive command shells.</para></listitem>
+        that expect interactive user input as services, such as interactive command shells.</para>
+
+        <para>Note that
+        <citerefentry><refentrytitle>machinectl</refentrytitle><manvolnum>1</manvolnum></citerefentry>'s
+        <command>shell</command> command is usually a better alternative for requesting a new, interactive login
+        session on the local host or a local container.</para></listitem>
       </varlistentry>
 
       <varlistentry>