Mailinglist Archive: opensuse (794 mails)

< Previous Next >
Re: [opensuse] systemd - zgrep -m1 gives me "gzip: stdout: Broken pipe" ?

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?


$ ( trap '' PIPE; seq inf | sed 1q )
seq: write error: Broken pipe

$ ( seq inf | sed 1q )

Have a nice day,

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

< Previous Next >
Follow Ups