Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^3: IO::Pty, Net::Telnet and SSH

by fmerges (Chaplain)
on Nov 04, 2006 at 16:40 UTC ( [id://582251]=note: print w/replies, xml ) Need Help??


in reply to Re^2: IO::Pty, Net::Telnet and SSH
in thread IO::Pty, Net::Telnet and SSH [SOLVED]

Hi,

And why not using something like a dispatch table, so things that don't need to be interactive uses the $ssh->cmd inside of the subroutines that handles the command, and for the ones you need interactive, you just use the $ssh->shell with Expect. Take a look at the shell method on Net::SSH::Perl.

Regards,

fmerges at irc.freenode.net

Replies are listed 'Best First'.
Re^4: IO::Pty, Net::Telnet and SSH
by gonza (Novice) on Nov 04, 2006 at 17:45 UTC

    Not a bad suggestion, but that defeats the purpose of this script I'm writing. I need to run an interactive program not on 1 server, on 500+ of them, so the idea is that this Perl script can connect to each server, and enter the same input that I gave the Perl script.

    To give you an idea how this all fits together, when I run my script, it asks me for a list of servers, then it asks me a few questions. Once I'm done entering the info, the script will (when I find a fix for this IO::Pty, Net::Telnet and SSH issue) connect to each server and run the interactive program with the input I gave the program. So running the $ssh->shell isn't going to work.

      Hi,

      Don't know if this will work for you, but I know people who solved this kind of issue writting small servers that provide system commands with RPC capabilities, using SOAP or XML-RPC for example.

      I mean first try with what you are doing, if it works okay, but otherwise think about this:

      Caller.pl <----XMLRPC/SOAP-----> Bridge.pl / | / System/Native Program <-----> Expect

      This way you can easily provide remote calls to existing programs that uses the STDIN without changing anything.

      Regards,

      fmerges at irc.freenode.net

        Hi,

        While it is a good suggestion, it would be practically *impossible* to have this sort of thing approved in the company I work for. The idea is not to have to install a new daemon on each of the servers I manage, I'd like to work with what's already there (ie. SSH/Telnet).

        Besides, not all servers have expect.

        I'd love to have a look at the ssh_config of the person who got this Net::Telnet example working (was that you?). I can't think of what else it might be. Also, the OpenSSH version might be useful too, just incase it's a version thing.

        Thanks!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://582251]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2024-04-20 01:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found