I am trying to capture output from an install script (that uses scp) and log it. However, I am not getting everything that scp is printing out, namely, the progress bar.
screen output:
Copying /user2/cdb/builds/tmp/uat/myfiles/* to server /users/myfiles as cdb
cdb@server's password: myfile 100% |*****************************| 2503 00:00
log output:
Copying /user2/cdb/builds/tmp/uat/myfiles/* to server /users/myfiles as cdb
I'd really like to know that my file got there. Here's what I am trying now to no avail:
myscript.sh 2>&1 | tee mylogfile.log
Does anyone have a good way to capture scp output and log it?
Thanks.
It looks like your just missing whether the scp was succesful or not from the log.
I'm guessing the scroll bar doesn't print to stdout and uses ncurses or some other kind of TUI?
You could just look at the return value of scp to see whether it was successful. Like
scp myfile user@host.com:. && echo success!
man scp
says
scp exits with 0 on success or >0 if an error occurred.