Results 1 to 4 of 4
hi all,
i know i am doing it wrong.
I need to output whatever that i am doing in my sftp to a log. how do i do it ?
...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 10-13-2011 #1Just Joined!
- Join Date
- Dec 2009
- Posts
- 9
how do i output sftp result to a file without scripting ?
hi all,
i know i am doing it wrong.
I need to output whatever that i am doing in my sftp to a log. how do i do it ?
--------------------------
I cannot see the commands i inputted, nor the file not found etc..
what is the correct way to do it ?
Regards,
Noob
- 10-13-2011 #2Just Joined!
- Join Date
- Dec 2009
- Posts
- 9
here what i done below :
[tomcat@AIS_WEB 201109]$ sftp login@host > test.log
Connecting to host...
Password:
put abc.txt
File "abc.txt" not found.
exit
[tomcat@AIS_WEB 201109]$ cat test.log
sftp> sftp>
[tomcat@AIS_WEB 201109]$
- 10-14-2011 #3Trusted Penguin
- Join Date
- May 2011
- Posts
- 3,664
My first instinct is to use Perl and the Net::SFTP module.
But if you don't want the Perl learning-curve (if you don't already know it), then I'd suggest running the sftp job in screen and using screen's built-in logging facility to capture the SFTP output.
You can call screen to run a job in detached mode - good for scripting ftp jobs.
Read the screen man page for details.
Or you could always set up SSH keys (to avoid having to use password prompts), and you could run your sftp jobs as scp calls, all non-interactively - easy to log the output of that.
- 10-14-2011 #4
sftp user@host | tee logfile
maybe?linux user # 503963


Reply With Quote
