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.
if [ -n "$COMPRESS" -a -s "$OUTFILE" -a $r -eq 0 ]; then
echo "Dump done: $(date)"
echo "Compressing dump file ($COMPRESS) ..."
if [ -n "$COMPRESS" -a -s "$OUTFILE" -a $r -eq 0 ]; then
echo "Dump done: $(date)"
echo "Compressing dump file ($COMPRESS) ..."
+ $COMPRESS "$OUTFILE" 2>&1
+ [ $? -eq 0 ] || echo "Error compressing dump file!" >&2
fi
echo "End: $(date)"
echo
fi
echo "End: $(date)"
echo