Click to See Complete Forum and Search --> : Redirecting rsync output to STDOUT AND file at same time??


carlos123
04-27-2003, 06:45 PM
In the following command...

rsync -avx --delete /home/ /mnt/backup/home/ 1> /mnt/backup/$(date +"%F_%R")-backup.log

How do I cause the output from rsync to not only be saved to the file being redirected to but ALSO have the output appear on the screen?

Anybody got any suggestions?

I tried "> 1 1>" and all kinds of other variations.

Carlos

bwkaz
04-27-2003, 07:27 PM
rsync -avx --delete /home/ /mnt/backup/home/ | tee /mnt/backup/$(date +"%F_%R")-backup.log

The "tee" command takes its stdin stream and writes it to the file you give it, and also prints it to stdout.

carlos123
04-27-2003, 09:23 PM
Thanks bwkaz! I never, ever have even seen the tee command show up in any listing of Linux commands.

But it does work and it's exactly what I need.

Carlos