Capture scp output


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Capture scp output
# 1  
Old 12-04-2007
Capture scp output

I have a simple script that uses scp to copy some files from one server to another. I want to capture the files that are copied but simple redirection to a file does not work.

So I want to capture this output from the scp command in a log file.

Code:
-bash-3.00$ scp -pr /export/jumpstart/Files server2:/export/jumpstart
config.driver        100% |*********************************************************|  1026       00:00
hardening.driver     100% |*********************************************************|  3876       00:00
secure.driver        100% |*********************************************************|   493       00:00
user.init            100% |*********************************************************|  2588       00:00
whole_zone.cfg       100% |*********************************************************|   122       00:00
sparse_zone.cfg      100% |*********************************************************|   276       00:00
sudoers.20071022     100% |*********************************************************|  6142       00:00
sudoers.20071023     100% |*********************************************************|  6142       00:00
sudoers.20071024     100% |*********************************************************|  6649       00:00
sudoers.20071024v1   100% |*********************************************************|  6933       00:00
sudoers.20071026     100% |*********************************************************|  7053       00:00
sudoers              100% |*********************************************************|  7383       00:00
ntp.conf-prd         100% |*********************************************************|   142       00:00
ntp.conf-dr          100% |*********************************************************|   136       00:00

-bash-3.00$

Tornado
# 2  
Old 12-04-2007
That's a progress meter and would look awful if captured to a file as it contains cursor control codes.
# 3  
Old 12-04-2007
Is there a way I could just capture the files that have been copied and their sizes, without the progress meter ?
Tornado
# 4  
Old 12-04-2007
This is not too good because stdin has to be a terminal:-

Code:
#!/bin/sh

ssh </dev/tty >output -i .ssh/somekey -t user@localhost scp -i .ssh/somekey files.... user@localhost:directory/

But works by forcing the allocation of a pseudo-terminal so scp thinks it's stdout is writing to a terminal.
# 5  
Old 12-04-2007
Another option would possibly to use 'script'.
This User Gave Thanks to reborg For This Post:
# 6  
Old 12-05-2007
I can't use script, as the scp is just a line in a script I am using to copy files. I just wanted to have the files that get copied listed in a log file.
Tornado
# 7  
Old 12-05-2007
Perhaps a copy/paste into a text file then. Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Grep -P does not capture the desired output

Hi, I'm trying to filter the following output to only display information about an alarm where the Status: corresponds to Set. -------------------------------------------------------- Description: hw_optics: RX POWER LANE-0 LOW ALARM Location: Optics0/0/0/21... (6 Replies)
Discussion started by: sand1234
6 Replies

2. Shell Programming and Scripting

Capture an USSD output then sms it

Hi, I need help. I want to capture an output from a USSD then sms it to a certain number for checking credits balance. I tried with this: echo "asterisk -rx 'gsm send ussd 1 *888#'"| asterisk -rx 'gsm send sms 1 0821733663' The *888# is the USSD, and the 0821733663 is destination number... (1 Reply)
Discussion started by: jazzyzha
1 Replies

3. Solaris

How to capture Output of truus command

Hi I want to check if some process is sleeping. I can see that in truss -p <pid> I want to capture output and check that output if proces sis sleeping. Please suggest way to capture output of truss command or other way to check if process is sleeping (1 Reply)
Discussion started by: ankush_mehra
1 Replies

4. Shell Programming and Scripting

Want ro capture the debug in output file

I want to capture the debug for the below command in output file . i tried like this but its not working: sh -xv <scriptname> >> output.log i want the output in a log file. Anyone plz help in this (2 Replies)
Discussion started by: chakkaravarthy
2 Replies

5. Shell Programming and Scripting

How to capture output to log file

Hi I have a script that will run multiple unix & sql commands. I want to see the output as well as capture it to a log file for further analysis. Is there an easy way to do that instead of adding "tee -a logfile" on everyline or even on the execute line (i.e. script | tee -s logfile). Thanks (1 Reply)
Discussion started by: nimo
1 Replies

6. Programming

capture the output of printf into another variable

Hi , I wonder if in java I can pipe the below output of the printf into a variable: System.out.printf(" This is a test %s\n", myVariable); I want to keep the output of the printf command to create my history array. Thanks. (2 Replies)
Discussion started by: arizah
2 Replies

7. Shell Programming and Scripting

Script to capture snoop output

Hi Everyone :), Need your advice as I'm new to UNIX scripting.. I'm trying to write a script to capture snoop output for 5 minutes for every hour for 24 hours. To stop snoop, I need to press Control-C to break it. This is what I got so far, but now I'm stuck! :confused: The script: # cat... (2 Replies)
Discussion started by: faraaris
2 Replies

8. Shell Programming and Scripting

script to capture certain output

Hi All, I want to create a script that capture only Date & Time, Current CPU % usage, Disk % usage, Mem % usage and Top process based on this output; Data Collected: 05/17/08 17:19:49 Refresh Interval: 600 seconds GlancePlus Started/Reset: 05/17/08 08:19:45 B3692A GlancePlus... (18 Replies)
Discussion started by: fara_aris
18 Replies

9. UNIX for Advanced & Expert Users

Capture output to file and printer

Hi All : I wanted a unix command by which I could be able to print the output to a file and at the same time to a printer. Any help will be greatly appreciated. Regards, Ramamurthy Dasari (1 Reply)
Discussion started by: rdasari
1 Replies

10. Shell Programming and Scripting

Capture output from interactive script

I have written a menu driven script to walk users through bringing up and down an application process. Sometimes the user tells me the script does not work taking the application down, but he can't recall seeing an error message. Is there a way to capture std out and stderr out from an... (6 Replies)
Discussion started by: MizzGail
6 Replies
Login or Register to Ask a Question