Mailinglist Archive: opensuse (794 mails)

< Previous Next >
Re: [opensuse] systemd - zgrep -m1 gives me "gzip: stdout: Broken pipe" ?
  • From: Per Jessen <per@xxxxxxxxxxxx>
  • Date: Wed, 29 Nov 2017 16:06:39 +0100
  • Message-id: <ovmidv$34s$>
Per Jessen wrote:

Bernhard Voelker wrote:

On 11/29/2017 11:01 AM, Per Jessen wrote:
Per Jessen wrote:

Okay, I need another pair of eyes -

in a bash script, I have "zgrep -m1 SOA file.gz". The script is
run under systemd. The line with SOA is found, but I always get
"gzip: stdout: Broken pipe".

zgrep is obviously "gzip -dc | grep".

I guess grep closes early when the first line is found, but why
this produce the error when running under systemd? If I remove
the '-m1', no problem, no message.

Adding '2>/dev/null' to the zgrep gets rid of the message, and I
guess StandardError=null in the service unit would do the same, but
why is the behaviour different when running under systemd ?

Maybe SIGPIPE is ignored / not ignored there?

Good suggestion, that sounds likely -

on the console:
(trap '' pipe; zgrep -m1 SOA file.gz )
$SOA 180 dev.null 1511967099 180 180 604800 180
gzip: stdout: Broken pipe

So I ought to be able to get rid of that message by adding

trap /bin/true pipe

to my script, I would think?

I'll just stick to the 2>/dev/null :-)

Per Jessen, Zürich (3.5°C) - dedicated server rental in Switzerland.

To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse+owner@xxxxxxxxxxxx

< Previous Next >