Problems with rlogin and executing a script

  • Thread starter Lukas Schnieper
  • Start date
L

Lukas Schnieper

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>")
os.system("./myscript.py")

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?
 
D

Dennis Lee Bieber

Lukas Schnieper fed this fish to the penguins on Wednesday 01 October
2003 12:59 am:
os.system("rlogin <hostname>")
os.system("./myscript.py")
Won't work.

EACH os.system() call is the equivalent of opening a new command
interpreter window. So what you have is the first call doing the remote
login, and then exiting, followed by the second os.system() creating a
new environment and trying to execute locally.
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 the various popen family. Though you may have to write the
entire sequence first before you can read the returns...

--
 
R

Richard

Lukas Schnieper said:
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>")
os.system("./myscript.py")

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?

It looks like your calling myscript.py from your local system, not the
remote system. You should probably try the Pexpect module (
http://pexpect.sourceforge.net/ ), which will let you control a
command line program like rlogin or ssh.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top