[systemd-devel] Fwd: Handling ExecStop failure

Lennart Poettering lennart at poettering.net
Mon May 23 08:50:25 UTC 2016


On Mon, 23.05.16 10:32, Reindl Harald (h.reindl at thelounge.net) wrote:

> 
> 
> Am 23.05.2016 um 10:00 schrieb Ashish Sangwan:
> >My second issue is, on failure of stopping/umounting, no failure
> >message appears on console although I have used StandardError option
> 
> sadly systemd don't print service outputs to console

Well, it does, if you set StandardOutput=journal+console the way
Ashish did it.

But maybe this is actually where the confusion comes from. Console
does not equal console. What Ashish is doing will write the commands
output directly to /dev/console, i.e. *not* the tty you are running
your commands from. This is because the service in question is a
system service, disconnected from your own tty.

> even something like "systemd-run -t --service-type=oneshot --quiet" behaves
> differently and don't work if you call it via crond to get the typical
> behavior of cronjobs sending mails when some output appears (imho a major
> bug by design or accident)

This is completely unrelated to Ashish' case.

Note that what you do above should actually work fine on current
systemd. With v230 I get:

<snip>
$ systemd-run -t --service-type=oneshot --quiet /bin/echo hallo | cat
hallo
</snip>

Which suggests this works fine.

This didn't always works though, and it was pretty nasty to get right
actually. The core of the problem is really that "-t" actually
allocates a tty, and ttys know no clean concept of single-direction
EOF, but only bi-directional hangups. Thus, using ttys as the backend
for inner components of shell pipeliness, without losing trailing data
is really hard to get right.

But anyway, this should work now. 

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list