sftp output to file.


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users sftp output to file.
# 1  
Old 08-19-2011
sftp output to file.

Hi friends,
How to log the STFP put command output to a file, please give me a solution to solve this problem.

This is the program..

Main File : cp_ftp_file.
Code:
send_file()
{
 sftp -b sftp_cmd_file_temp.txt ingrammicro@secure.streamliteinc.com 
}
echo 'Manifest FTP started....'
send_file
grep -ic "100" /app/csw/bin/ftp_output_log_IMP573 > /app/csw/bin/ftp_temp_IMP573

Batch File :sftp_cmd_file_temp.txt
Code:
progress
cd incoming/
put TestFiletest 
quit

OutPut:
Code:
Manifest FTP started....
sftp> progress
Progress meter enabled
sftp> cd incoming/
sftp> put TestFiletest 
Uploading TestFiletest to /Home/ingrammicro/incoming/TestFiletest
TestFiletest                              100%   74     0.1KB/s   00:00   
sftp> quit

Here the output is created manually by running the program in the unix prompt, i need to log this output to the file.

Last edited by Scott; 08-20-2011 at 07:30 AM.. Reason: Code tags
# 2  
Old 08-19-2011
Code:
sftp ... > /path/to/my.log 2>&1

# 3  
Old 08-19-2011
Hi frank_rizzo,
Thanks for your reply...

Manually output:
Code:
Manifest FTP started....
sftp> progress
Progress meter enabled
sftp> cd incoming/
sftp> put TestFiletest
Uploading TestFiletest to /Home/ingrammicro/incoming/TestFiletest
TestFiletest                                                                       100% 74 0.1KB/s 00:00
sftp> quit

Log file Output :
Code:
sftp> progress
Progress meter enabled
sftp> cd incoming/
sftp> put TestFiletest  
Uploading TestFiletest to /Home/ingrammicro/incoming/TestFiletest
sftp> quit

As you can see that second get command output line(which includes some statistics.. ie.. TestFiletest 100% 74 0.1KB/s 00:00) is missing.

Any way to include that statistics line into my log ?

Last edited by Scott; 08-20-2011 at 07:31 AM.. Reason: Code tags
# 4  
Old 08-19-2011
your executing in batch mode so I believe the progress meter is disabled.
# 5  
Old 08-19-2011
Hi frank_rizzo
I enabled the progress meter also, you clearly seen that line
(sftp> progress
Progress meter enabled)
in the output...
Any other way to include that statistics line into my log ?
# 6  
Old 08-19-2011
Quote:
Originally Posted by sundar.lsr
Any other way to include that statistics line into my log ?
no -b batch mode disables this by design.
# 7  
Old 08-20-2011
Hi frank_rizzo
how to over come this problem..

Last edited by sundar.lsr; 08-20-2011 at 02:42 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

Command understanding the output file destination in case of standard output!!!!!

I ran the following command. cat abc.c > abc.c I got message the following message from command cat: cat: abc.c : input file is same as the output file How the command came to know of the destination file name as the command is sending output to standard file. (3 Replies)
Discussion started by: ravisingh
3 Replies

2. Shell Programming and Scripting

Displaying log file pattern output in tabular form output

Hi All, I have result log file which looks like this (below): from the content need to consolidate the result and put it in tabular form 1). Intercomponents Checking Passed: All Server are passed. ====================================================================== 2). OS version Checking... (9 Replies)
Discussion started by: Optimus81
9 Replies

3. Shell Programming and Scripting

script to mail monitoring output if required or redirect output to log file

Below script perfectly works, giving below mail output. BUT, I want to make the script mail only if there are any D-Defined/T-Transition/B-Broken State WPARs and also to copy the output generated during monitoring to a temporary log file, which gets cleaned up every week. Need suggestions. ... (4 Replies)
Discussion started by: aix_admin_007
4 Replies

4. Shell Programming and Scripting

Awk script to run a sql and print the output to an output file

Hi All, I have around 900 Select Sql's which I would like to run in an awk script and print the output of those sql's in an txt file. Can you anyone pls let me know how do I do it and execute the awk script? Thanks. (4 Replies)
Discussion started by: adept
4 Replies

5. Shell Programming and Scripting

Redirect SFTP Output only

HI Guys, My requiement is to redirect output and error of sftp to a file.I have gone through few solutions given in this forum and got the alternate solution but not the one i want. Below piece of code is not working .. $ sftp user@server<<EOF 2>&1 >temp.txt > cd <dir> > ls > EOF... (0 Replies)
Discussion started by: mohanpadamata
0 Replies

6. UNIX for Dummies Questions & Answers

sftp output is different when running manually/script

When I manually run a sftp to a remote server I receive the following output on he screen; Uploading filename to /inbound/xxxxxxx_Folder_1/filename filename 100% 50 0.1KB/s ... (1 Reply)
Discussion started by: rugggy
1 Replies

7. Shell Programming and Scripting

sftp output is different when running manually/script

When I manually sftp a file to a remote server I get the following output on the screen; Uploading filename to /inbound/xxxxxxx_Folder_1/filename filename 100% 50 0.1KB/s 00:00 When I run the commands from within a shell script I do not get the "filename ... (0 Replies)
Discussion started by: rugggy
0 Replies

8. Shell Programming and Scripting

Dynamic output file generation using a input text file with predefined output format

Hi, I have two files , one file with data file with attributes that need to be sent to another file to generate a predefined format. Example: File.txt AP|{SSHA}VEEg42CNCghUnGhCVg== APVG3|{SSHA}XK|"password" AP3|{SSHA}XK|"This is test" .... etc --------- test.sh has... (1 Reply)
Discussion started by: hudson03051nh
1 Replies

9. Shell Programming and Scripting

sftp verbose output

We need to use sftp to replace the ftp on all our application scripts. The command itself works, however,the output from the verbose is not giving us a success response with a transfer count. Our processes require that we interrogate the response to ensure the data transfer was successful. ... (2 Replies)
Discussion started by: MizzGail
2 Replies

10. Shell Programming and Scripting

Redirect output from sFTP

Hey all, I have a ksh script which used ftp to transfter certain files to a AIX server, however, now I have to switch to sFTP and I have the following problem. Originally, output=`ftp -nv $AIX_HOST << EOF 2>&1 user $AIX_USER $AIX_PASSWORD cd... (9 Replies)
Discussion started by: mpang_
9 Replies
Login or Register to Ask a Question