简体   繁体   中英

How can I keep an ssh connection open on windows and use it with perl?

I am trying to work on a old script of mine that I was writing to backup file on my VMware server.

Originally the script was going to run on Linux only, but now I trying to figure out how to make it run on Windows. Most of the modules I need for perl will run on Windows and Linux which is good. But there is one module that I can't seem to find, which is an SSH module.

My plan was to use putty or plink to send commands to the server and return them to the script. But the problem that I see is every time I call putty in the script its going to open new connection to server and close it when it has finished. What I am looking for is a way to open a connection once its open leave it open and then send and receive from that one connection. Only having it close when the script calls a close function or something.

Any idea where I could being with something like this?

Unless someone else has a much better idea because I am open to anything.

CPAN有很多SSH客户端模块,例如Net :: SSH,Net :: SSH :: Perl和Net :: SSH2。

You can also try using Expect

http://metacpan.org/pod/Expect

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM