1

I'm using tmux and cueing up a very large copy:

/bin/cp -aRv /mnt/src/folder/. /mnt/dest/folder/ 2>&1 | tee /log/big_copy_log

When I run without tee, I see output on the terminal just fine. With tee, nothing shows in the logfile or screen. What am I missing?

  • I don't mind stderr and stdout both going to the same log.
  • I want to do this logging so I can audit later if necessary (multiple TB sized copy)
  • The -a is because I'd like timestamps preserved, -R because there are multiple levels of folders to move, -v to log everything.
  • I wasn't planning to use rsync, since this is designed to be a one-way copy.
  • Using /bin/cp because cp is aliased.
  • Tailing . on the src because I need all subfolders copied to dest folder
  • 1
    Try 2>&1 instead of 2&>1. – pfnuesel Apr 07 '17 at 15:38
  • Whoops, typo in the question syntax ... I'm using correct syntax in the actual command... – user3.1415927 Apr 07 '17 at 15:48
  • 3
    Oh wow, hang on, if you're copying multiple TB use rsync! – terdon Apr 07 '17 at 15:54
  • I was averse to using rsync because I wanted to only do things one way, not sync back to src from dest ... – user3.1415927 Apr 07 '17 at 15:56
  • 1
    Nothing when? Right away, or after the command has run (enough to fill up a flush a buffer or to completion)? – thrig Apr 07 '17 at 16:03
  • 4
    "I wasn't planning to use rsync, since this is designed to be a one-way copy" -- This doesn't make sense. rsync is one way. And rsync has the ability to write to a log file natively, meaning no need to use tee. – phemmer Apr 07 '17 at 16:06
  • 4
    It is also faster, can compress while copying and is much, much better than cp at resuming unfinished transfers. The latter is particularly important when dealing with huge amounts of data. Basically, it is designed to solve all the issues you are asking about. Use it! – terdon Apr 07 '17 at 16:13
  • Thanks, I just used rsync. I did indeed understand it wrong. I appreciate the opportunity to learn. – user3.1415927 Apr 08 '17 at 01:25
  • This question is not a duplicate of http://unix.stackexchange.com/questions/101681/saving-output-of-another-command. SE needs a flag for "Solved through different means than originally asked, and thus this question remains (and likely will remain) unanswered." – user3.1415927 Apr 10 '17 at 23:51

0 Answers0