Mailinglist Archive: opensuse (794 mails)

< Previous Next >
[opensuse] systemd - zgrep -m1 gives me "gzip: stdout: Broken pipe" ?
  • From: Per Jessen <per@xxxxxxxxxxxx>
  • Date: Wed, 29 Nov 2017 10:51:19 +0100
  • Message-id: <ovlvun$ku$1@saturn.local.net>
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.

In the console, if I run the "zgrep -m1" manually or from within a
script, no problem, no message.

The script itself (suitably redacted) is nothing much:

#!/bin/sh
sec=47
addr=1.2.3.4
name=myscript
version=1.1
echo "$name started, version $version, cwd=$PWD"
trap "echo \"$name terminated\"" exit

while true
do
a=$(date +%S)
a=${a#0}
w=$(((60+sec-a)%60))
sleep $w
echo "running rsync ..."
rsync -rvt -q -4 --address=$addr etc etc
zgrep -m1 SOA newfile.gz
make -r -C /srv/rbldnsd 2>&1 >>updatelog
sleep 1
done




--
Per Jessen, Zürich (3.9°C)
http://www.hostsuisse.com/ - virtual servers, made in Switzerland.


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

< Previous Next >