can't capture scp progress bar in output redirect
Hi all,
I would really like to capture the output of scp and my file's progress. Scp updates the transfer rate every 1 second, and I will like to save the transfer rate at every update. So for example, if the file transfer takes 30 seconds, I would like 30 reports of the transfer rate. The output looks like: Code:
file.dat 1% 3664KB 938.5KB/s 05:48 Code:
scp file.dat 192.168.1.100:~/ &> output If I try using typescript by starting "script" ... it's the same deal. I'd greatly appreciate any suggestions, thanks! |
scp uses the "isatty()" function call to see if its output goes someplace sane, and doesn't print anything if it's not a tty (frankly I'm surprised you get the final update).
Anyway, try this: Code:
ssh localhost -t scp file.dat 192.168.1.100: > output |
Quote:
However, whenever I try this command I keep getting: Code:
connection to localhost closed. |
eek, got that working... problem was that the file didn't exist in the home directory. but it still doesn't capture each update :\ same as before
|
How are you viewing the file "output"? If you're using "cat" then it will output every character as they appear in the file, and scp uses the "carriage return" character to overwrite the last update with the new update, so you'll only see the last output. The file probably does include every update line.
Try using a pager like less, or something like this: Code:
sed 's/\r/\n/g' output |
hmmmm we are getting somewhere! the file size is continually growing, replace \r doesn't seem to get me very far though. still only shows the final (or current rate)
|
Well I guess your version of scp doesn't suppress output when redirecting, so the following ought to work:
Code:
scp file.dat 192.168.1.100: | tr '\r' '\n' > output |
Quote:
|
All times are GMT -5. The time now is 01:13 PM. |