]> arthur.barton.de Git - MkMySqlDump.git/commitdiff
Show output of compression program to stdout, not stderr
authorAlexander Barton <alex@barton.de>
Sun, 22 Oct 2017 16:37:39 +0000 (18:37 +0200)
committerAlexander Barton <alex@barton.de>
Sun, 22 Oct 2017 16:37:39 +0000 (18:37 +0200)
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.

bin/mkmysqldump

index 87f9db2b73df5ef854ee09aef0ab792259621ab3..0dc345da357d5ec1b1b79e4804a43161fcedc67f 100755 (executable)
@@ -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