Thread

Posted on Wed Oct 4 01:32:05 2006 by astern
SFTP Exit call stops perl script
I am using perl to transfer file from a remote server to another using sftp. I'm not sure what it means, but we connect to the server using Expect. When the transfer is done (the transfer works fine), there is code to exit sftp. The exit, though, not only exits the sftp connection, but also stops the perl script. How can I exit the sftp connection, but still maintain the perl script? Also, what is the interact used for? Here is some of the code: my $expt = Expect->spawn("sftp ".$destination_ftp_username."\@".$destination_server); $expt->send("$destination_ftp_password\n"); $expt->send("cd $destination\n"); $expt->send("put ".$rootdir.$tempdir.$fileinfo[1]."\n"); $expt->send("exit\n"); $expt->interact;
Direct Responses: 3193 | 4699 | Write a response
Posted on Wed Oct 4 17:46:17 2006 by monkeychunks in response to 3183
Re: SFTP Exit call stops perl script

This may or may not help...

I use the Net::SFTP module, and it doesn't include a builtin disconnect command. To disconnect the SFTP connection, I close the socket:

close($sftphandle->{ssh}->sock());

Maybe something similar would work for you?

Write a response
Posted on Wed Mar 28 22:01:56 2007 by vperl in response to 3183
Re: SFTP Exit call stops perl script
What Expect module are you calling? THere is a Net::SCP::Expect - I doubt if you are using that.
Write a response