[rancid] Re: Custom devices and ttys

David Luyer david+rancid at luyer.net
Tue Oct 9 17:37:39 UTC 2007


Rather than messing with $LINES and $COLUMNS which are shell convenience
variables, you might have more luck along the lines of:

   spawn telnetscript.sh $router

and then in telnetscript.sh

   #!/bin/sh
   stty rows 1024
   stty cols 1024
   exec telnet $*

I don't have the device in question to test, so, good luck! :)

David.



> Hi
>
> I'm trying to customize a rancid plugin to work with an Ellacoya e30
> which has a very cisco like interface.
> clogin works fine from the command line by bails out when run from cron.
>
>  From cron it asks me to "press any key to continue", when I send a
> carriage return, or any other key it asks me the same thing again.
>
> it seems that the e30 behaves differently when there is a tty
> attached, as when I add -nottycopy after the spawn in the login
> script I get the same behavior on the cli as when it is run from cron
> without the ttycopy option.
> ie to get this behavior on the cli I changed
>                  set retval [ catch {spawn telnet $router} reason ]
> to
>                  set retval [ catch {spawn -nottycopy telnet $router}
> reason ]
>
> Anyone here got any experience with devices that behave like this?
> Or does anyone know the expect syntax to make rancid behave as if
> there is a tty?
>
> I'm reasonably sure it's a tty issue as I have manually set
> environment variables such as TERM,COLUMNS,LINES etc. A packet trace
> of the telnet session shows that when launched from cron the width
> and height is set to zero when it negotiates the window size.
>
> http://expect.nist.gov/FAQ.html#q26 implies there is a way to do this
> but helpfully you have to buy their book.
>
> http://www.issociate.de/board/post/181281/%22expect%
> 22_spawns_telnet_--_screen_height.html seems to solve a very similar
> issue in a perl script.
>
> Any ideas?
>
> Thanks
>
> --
> | Mark Loveley                                  Broadband Solutions for
> | Network Engineer                                    home and business
> | PlusNet PLC                                             @www.plus.net
> | Registered Office: Internet House, 2 Tenter Street, Sheffield, S1 4BY
> | Registered in England no: 3279013
> + ------------ PlusNet - The smarter way to broadband ----------------+
>
>
>
> _______________________________________________
> Rancid-discuss mailing list
> Rancid-discuss at shrubbery.net
> http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss
>




More information about the Rancid-discuss mailing list