From: Alexander Barton Date: Sun, 22 Oct 2017 16:37:39 +0000 (+0200) Subject: Show output of compression program to stdout, not stderr X-Git-Url: https://arthur.barton.de/gitweb/?p=MkMySqlDump.git;a=commitdiff_plain;h=b8e78c656a4085d61899609d958341167dfbf81c Show output of compression program to stdout, not stderr Some compression programs show their status output on stderr [xz(1), for example], so redirect to stdout and display an extra error message when the compression program exited "non zero". This enhances the user experience when using some "mail wrapper" scripts etc. --- diff --git a/bin/mkmysqldump b/bin/mkmysqldump index 87f9db2..0dc345d 100755 --- a/bin/mkmysqldump +++ b/bin/mkmysqldump @@ -168,7 +168,8 @@ $CMD >"$OUTFILE"; r=$? if [ -n "$COMPRESS" -a -s "$OUTFILE" -a $r -eq 0 ]; then echo "Dump done: $(date)" echo "Compressing dump file ($COMPRESS) ..." - $COMPRESS "$OUTFILE" + $COMPRESS "$OUTFILE" 2>&1 + [ $? -eq 0 ] || echo "Error compressing dump file!" >&2 fi echo "End: $(date)" echo