[rancid] Re: Custom devices and ttys

David Luyer david+rancid at luyer.net
Wed Oct 10 16:52:38 UTC 2007


> On 9 Oct 2007, at 18:37, David Luyer wrote:
>> Rather than messing with $LINES and $COLUMNS which are shell
>> convenience
>> variables, you might have more luck along the lines of:
>>    #!/bin/sh
>>    stty rows 1024
>>    stty cols 1024
>>    exec telnet $*
>
> Already been down this path. Unfortunately cron has no controlling
> pty and so the script errors with a stty error.
>
> couldn't write file "/dev/tty": no such device or address
>      while executing
> "exec /bin/stty cols 140 >/dev/tty"
>      invoked from within
> "stty cols 140"
>
> I tried this by using the stty command within the expect script, as
> expect sees stty as a valid option. from the man page:-
>      stty args
>               changes terminal modes similarly to the external stty
> command.

The approach you tried failed because there is no tty at this point.
However if you try the exact approach above (wrapping telnet and using
spawn to call the wrapper) there is a tty.  That's exactly what expect
does (creates a tty).

David.



More information about the Rancid-discuss mailing list