[Fwd: Re: Problems with rlogin and executing a script]
mfranklin1 at gatwick.westerngeco.slb.com
Wed Oct 1 14:55:49 CEST 2003
Sorry Lukas I sent this to you only!
From: Martin Franklin <mfranklin1 at gatwick.westerngeco.slb.com>
To: Lukas Schnieper <schnieper at semafor.ch>
Subject: Re: Problems with rlogin and executing a script
Date: Wed, 01 Oct 2003 12:35:23 +0100
On Wed, 2003-10-01 at 08:59, Lukas Schnieper wrote:
> Hi all
> I work with Suse Linux 8.2 and Python 2.2.2
> I'm trying to make a python script which makes a rlogin to another
> system and executes there another script. So it looks like this:
> os.system("rlogin <hostname>")
> The rlogin is ok. I can give in my password and i'm on the other host.
> But the script goes not on until i exit the rlogin. How can a execute a
> command on the new machine on which i'm logged in?
Check out pexpect http://pexpect.sourceforge.net/ it will give you much
greater control. I'm ashamed to say I only 'discovered' it a couple of weeks ago.
It comes with some simple to follow examples. I used it to wrap sftp (amongst
other things) As far as I can tell the only drawback is that it will only work on posix
like systems (Linux, UNIX etc) not Windows, I could be wrong about this though...
On an unrelated topic you should think about using ssh rather than rlogin as it
is much more secure (passwords are not sent to the remote machine as clear text!)
Martin Franklin <mfranklin1 at gatwick.westerngeco.slb.com>
More information about the Python-list