Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
First off..thanks to any who try to help me. :) I do appreciate it.
The goal: To go out and query our 'lightwaves' (I am a UNIX admin, and lightwaves are stripped-down linux boxes connected to the serial ports of our servers, to give us a remote console)for server/port information. Hard to believe, as of now, we don't have records and we work in a VERY LARGE ENVIRONMENT.
The tools: Hopefully, Perl's Expect.pm.
The drawback: I do not know Expect; I have chosen Perl's Expect module because I am adequate in Perl (although by no means and expert) and am learning more.
The problem: The documentation I've read is like mud to me, which , I guess, is because I don't know Expect and have never played around with pty's, etc.
I can spawn a ssh process, and issue commands to it, but I'm stuck on figuring out how to capture the output.
My ask is two-fold: 1) Does anyone know of a good source to read about using Expect.pm?
2) Given the code snippet below, can anyone guide me on how to capture the output of the 'listdev' command I issued on the lightwave? (plycon1 ). That is the part where I'm running into trouble.
Thank you!($ssh = Expect->spawn("ssh -l sysadmin $server")) || die "couldn't sp +awn ssh: $!"; unless ($ssh->expect(10,"password")) { die "never got username prompt on $server, " .ssh->exp_error() +,"\n"; } print $ssh "$password\r"; unless ($ssh->expect(10,"sysadmin>")) { die "never got sysadmin prompt on $server, " .ssh ->exp_error( +),"\n"; } print $ssh "listdev\r";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Expect.pm question
by Bloodnok (Vicar) on Dec 22, 2008 at 21:56 UTC | |
|
Re: Expect.pm question
by almut (Canon) on Dec 22, 2008 at 23:08 UTC | |
|
Re: Expect.pm question
by liverpole (Monsignor) on Dec 23, 2008 at 16:57 UTC | |
|
Re: Expect.pm question
by hbm (Hermit) on Dec 23, 2008 at 14:09 UTC |