Good Morning Monks, I have a couple of sftp related questions... first, because i couldn't get Net::SFTP installed correctly i went the system call route which is working for me,but i can't seem to capture the error from STDOUT when no file is found. This is preventing me from retrying when the error message is: "Couldn't stat remote file: No such file or directory" which i know i'm getting because it's in the STDOUT file after i run my code. I can't seem to check STDOUT for the message while it's still open. Is there a way to do this? A snippet of my code is as follows
open STDOUT,">$log" || die "Cannot open log forwriting.!"; open STDERR, ">&STDOUT" or die "Can't dup stdout"; @ret = `sftp $user\@$server <<EOF cd $srcdir $cmd $srcfile $tgtfile bye EOF`; while (<STDOUT>) { print "inside STDOUT and row is $_\n"; print "err is $_ ...retrying\n" if /No such file/; }
How can i check the STDOUT for the "No such file" error message that is in the STDOUT file?
Secondly, I'd prefer to use the Net::SFTP module. I believe it's a 3 step process where: 1) the target server needs my pub.key appended to it's authorized_keys file (which it does) 2) i need to install the Net-SSH-Perl-1.34.tar module. 3) i need to install the Net-SFTP-0.10.tar. Are these the 3 steps that need to occur? I'm having issues installing the module and getting it to work, so perhaps i'm missing a step or another dependent module? Any help would be greatly appreciated. thanks
In reply to Having trouble getting sftp to work by dirtdog
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |