How to pipe the stdout to a file if the current command is already being piped through gzip

7,600

innobackupex doesn't output its progress on stdout, otherwise, it would end up in the tar.gz file. Most likely, it outputs it to stderr (a quick glance at the script seems to confirm it), so what you need to do is redirect its stderr:

innobackupex ... 2>> progress.log | gzip > file.tar.gz
Share:
7,600

Related videos on Youtube

Tom G11
Author by

Tom G11

Updated on September 18, 2022

Comments

  • Tom G11
    Tom G11 over 1 year

    So I have this command I need to run then disown:

    innobackupex-1.5.1 --user=root --password=**** --stream=tar ./ | gzip - > /data/myfile.tar.gz
    

    How do I pipe any output to a file?

    adding another >> to the end of this command only appends the gzip data.

    to be more specific; innobackupex has progress output - I want this output appended/piped to a file (not just errors). The normal way of doing this (by adding >>) will not work in this case due to the gzip already piping

    • goldilocks
      goldilocks over 11 years
      Really ambiguous question Tom. Just look at your answers.
  • Tom G11
    Tom G11 over 11 years
    STDOUT from innobackupex piped to a file would be since there is a lot of information - especially progress information -
  • tink
    tink over 11 years
    Ummm ... that doesn't explain what you want to achieve, either. You're already handling STDOUT from innobackupex using the pipe into gzip.