Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re: use telnet to router with expect

by RMGir (Prior)
on Mar 14, 2014 at 13:18 UTC ( #1078327=note: print w/replies, xml ) Need Help??

in reply to use telnet to router with expect

"Does not run" meaning the spawn fails? Or at a later step? You might want to add an
or die "Expect spawn failed, error $!";
to the end of your spawn command - that might tell you WHY it's failing...

I assume isn't the IP address you're actually using - but if it is, that would explain the failure :)


Replies are listed 'Best First'.
Re^2: use telnet to router with expect
by fionbarr (Friar) on Mar 14, 2014 at 13:52 UTC
    thanks Mike...everything works except the 'show inventory' command. The login succeeds and I see the router prompt. At that point, the script says: 'print $command "show inventory"' and the command does not execute.

      I'd download a copy of wireshark (a.k.a. tcpdump) and look at what goes over the wire when you do the command interactively with telnet - perhaps there's a \r sent somewhere you're using a \n, for example.

      Another possibility - maybe "hard_close" is closing the command before the server can respond?

      What happens if you switch that to "soft_close", or even expect something you'd see at the end of the inventory before closing?


Log In?

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2023-10-04 22:52 GMT
Find Nodes?
    Voting Booth?

    No recent polls found