From: Carlos G Mendioroz (tron@huapi.ba.ar)
Date: Tue Nov 04 2008 - 08:52:04 ARST
Tony,
late reply but...
I've been using perl expect for configurations for a while.
Soon enough I discovered that "being in the wrong box" was an issue.
You can (AFAIK) test if that is the case by trying to get out:
## Get off any previous session
sleep(1);
$router->clear_accum();
$router->send("\036");
$pat = $router->expect(2, "\007");
if (!defined($pat)) {
$router->send("x");
$pat = $router->expect(1, '-re', '[\w-]*>$', '-re', '[\w-]*#$');
if (defined($pat)) {
# Seems like we where somewhere else...
$router->send("disconnect\r");
sleep(1);
$router->send("\r");
}
}
sleep(1);
$router->clear_accum();
i.e. Ctl-^ will ring bells if NOT in session.
-Carlos
Tony Schaffran @ 22/10/2008 23:01 -0200 dixit:
> Does anybody have good illustrated examples of a expect script using telnet?
> Also with the use of some reverse telnet commands like CTRL+SHIFT+6 X
>
> I am green with this and cannot seem to be able to find any good reference.
>
> Any help would be appreciated.
>
>
> Tony Schaffran
>
> Sr. Network Consultant
>
> CCIE #11071
>
> CCNP, CCNA, CCDA,
>
> NNCDS, NNCSS, CNE, MCSE
>
>
>
> www.cconlinelabs.com
>
> Your #1 choice for online Cisco rack rentals.
>
>
> Blogs and organic groups at http://www.ccie.net
>
> _______________________________________________________________________
> Subscription information may be found at:
> http://www.groupstudy.com/list/CCIELab.html
>
>
>
>
>
>
>
>
-- Carlos G Mendioroz <tron@huapi.ba.ar> LW7 EQI ArgentinaBlogs and organic groups at http://www.ccie.net
This archive was generated by hypermail 2.1.4 : Mon Dec 01 2008 - 08:18:29 ARST