Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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

share|improve this question
    
Really ambiguous question Tom. Just look at your answers. –  goldilocks Jan 29 '13 at 20:04
add comment

4 Answers 4

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|improve this answer
add comment

Do you mean to capture STDERR from innobackupex? Your question isn't very clear.

innobackupex-1.5.1 --user=root --password=**** --stream=tar ./ 2> /path/to/file | gzip - > ... 
share|improve this answer
    
STDOUT from innobackupex piped to a file would be since there is a lot of information - especially progress information - –  Tom G11 Jan 29 '13 at 20:09
    
Ummm ... that doesn't explain what you want to achieve, either. You're already handling STDOUT from innobackupex using the pipe into gzip. –  tink Jan 29 '13 at 20:13
add comment

I would do it by means of running these commands in a subshell

( innobackupex-1.5.1 --user=root --password=**** --stream=tar ./ \
   | gzip - >  /data/myfile.tar.gz ) 2> errors
share|improve this answer
add comment

1) If you mean, you want to pipe the output to both gzip for compression and a regular file, here's an example of tee usage:

ls -a ~ | tee ls.txt - | grep "^\."

This will print all of the "hidden" dot files in your home directory (because of grep), but the entire output of ls -a will be in ls.txt.

See man tee for a complete explanation.

2) If you mean you want to include the standard error stream in the standard output stream, append 2>&1 to the command.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.