Can I do it using python?? about xterm and telnet

cmdrrickhunter@yaho.com conrad.ammon at gmail.com
Sun Jul 2 16:34:44 EDT 2006


I used this _EXACT_ solution(copied below) at work a month ago, to
start 20ish programs, each with different settings.  In this case I HAD
to use telnet for some of them, because they were on an embedded
machine, 4 of them used SSH(across the internet), and the rest were
local programs.  It worked flawlessly each time (every restart of the
network... which was quite often in this case).  There may be more
integrated solutions which solve the problem, but expect is rediculousy
easy to use, and is very deterministic as long as the commands work.
If the commands fail to work (such as someone deletes your program),
debugging is rather difficult, but at least you have a full dump of
everything sent by the server (because pexpect prints it all to the
screen).  Also, once the connection is open, you can call
conn.interact() and it will make the terminal interactive, just like
any other shell.


vasudevram wrote:
> Just FYI - pexpect is a Python app that works like Expect - which is by
> Don Libes and written in TCL. Expect comes with most Linux
> distributions and is available for most UNIX / Linux versions from its
> web site http://expect.nist.gov/
>
> The expect man page is enough to get started for simple needs, such as
> yours appears to be. You might want to play around with the original
> Expect a bit and then try out pexpect  - or you could just use Expect
> itself for your needs.
>
> HTH
> Vasudev
> ---
> Vasudev Ram
> Independent software consultant
> http://www.geocities.com/vasudevram
> PDF conversion toolkit:
> http://sourceforge.net/projects/xtopdf
> ---
>
>
> faulkner wrote:
> > try pexpect.
> > http://pexpect.sourceforge.net/
> >
> > valpa wrote:
> > > I'm a net admin for about 20 unix servers, and I need to frequently
> > > telnet on to them and configure them.
> > > It is a tiring job to open a xterm and telnet, username, password to
> > > each server.
> > >
> > > Can I  do it automatically by python? After that, there have 20 xterm
> > > consoles opened and telneted to their corresponding servers. Then I
> > > could start to type command in these xterms.
> > > 
> > > Any suggestion appreciate. Much thanks.




More information about the Python-list mailing list