eddie at holyrood.ed.ac.uk
Fri Jan 10 18:15:36 CET 2003
"Dickerson, Dee" <Dickerson4 at dow.com> writes:
>Below is telnet code that I am trying to get going. I am going from a Windows2000 machine to a Redhat Linux machine; the ls command will not run as I can tell; it does not return any output.
>I need to be able to execute other commands such as ps with options such as
>ps -eda -format pid,command |grep legion-server,,,,, etc|
>I would appreciate any help that anyone could offer.
>from hostlistdee import hostlistdee
>for host in hostlistdee:
> tn.read_until("login: ")
> tn.read_until('Password: ')
> print 'started ',host
> print 'failed ',host
> # end try
># end def
2 things. How do you know there's no output if you don't print the results
from tn.read_*? and secondly you should never close a telnet connection until
you've safely read all outstanding data because closing the connection flushes
all outstanding data and you don't see it. The 'exit' command, I think, will
cause the far end to close the connection.
More information about the Python-list