From 7f129a1f7c934123061aa26029cff1784805f878 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sat, 24 Dec 2016 01:08:15 +0100 Subject: man: document that "systemd-run -M" propagates exit codes, and "machinectl shell" does not MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 | 18 ++++++++++++------ man/systemd-run.xml | 7 ++++++- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/man/machinectl.xml b/man/machinectl.xml index 8bebdcf9a1..38cf919a78 100644 --- a/man/machinectl.xml +++ b/man/machinectl.xml @@ -428,6 +428,9 @@ user may be selected. Use to set environment variables for the executed process. + Note that machinectl shell does not propagate the exit code/status of the invoked + shell process. Use systemd-run instead if that information is required (see below). + When using the shell command without arguments, (thus invoking the executed shell or command on the local host), it is in many ways similar to a - Note that - systemd-run1 - may be used in place of the shell command, - and allows more detailed, low-level configuration of the - invoked unit. However, it is frequently more privileged than - the shell command. + Note that systemd-run1 + with its switch may be used in place of the machinectl shell + 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 + systemd-run's switch to propagate exit status information of the + invoked process. Use systemd-run's switch for acquiring an + interactive shell, similar to machinectl shell. In general, systemd-run + is preferable for scripting purposes. However, note that systemd-run might require higher + privileges than machinectl shell. diff --git a/man/systemd-run.xml b/man/systemd-run.xml index 2ad8cb0835..8d881f15d6 100644 --- a/man/systemd-run.xml +++ b/man/systemd-run.xml @@ -221,7 +221,12 @@ When invoking the command, the transient service connects its standard input and output to the terminal systemd-run is invoked on, via a pseudo TTY device. This allows running binaries - that expect interactive user input as services, such as interactive command shells. + that expect interactive user input as services, such as interactive command shells. + + Note that + machinectl1's + shell command is usually a better alternative for requesting a new, interactive login + session on the local host or a local container. -- cgit v1.2.3-54-g00ecf