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 15:57:52 +0100
  • Message-id: <ovmhtg$34s$1@saturn.local.net>
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
being
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 does
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 zone.jessen.ch 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?



--
Per Jessen, Zürich (3.7°C)
http://www.dns24.ch/ - free dynamic DNS, made in Switzerland.


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

< Previous Next >