Problems with rlogin and executing a script

Discussion in 'Python' started by Lukas Schnieper, Oct 1, 2003.

  1. 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?
     
    Lukas Schnieper, Oct 1, 2003
    #1
    1. Advertising

  2. 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...

    --
    > ============================================================== <
    > | Wulfraed Dennis Lee Bieber KD6MOG <
    > | Bestiaria Support Staff <
    > ============================================================== <
    > Bestiaria Home Page: http://www.beastie.dm.net/ <
    > Home Page: http://www.dm.net/~wulfraed/ <
     
    Dennis Lee Bieber, Oct 1, 2003
    #2
    1. Advertising

  3. Lukas Schnieper

    Richard Guest

    Lukas Schnieper <> wrote in message news:<>...
    > 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.
     
    Richard, Oct 1, 2003
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Bryan Hesters

    Rlogin Library?

    Bryan Hesters, Oct 9, 2003, in forum: C++
    Replies:
    1
    Views:
    412
    Thomas Matthews
    Oct 9, 2003
  2. Martin Franklin
    Replies:
    0
    Views:
    374
    Martin Franklin
    Oct 1, 2003
  3. walala
    Replies:
    2
    Views:
    1,911
    Francis Avila
    Nov 12, 2003
  4. David H
    Replies:
    0
    Views:
    487
    David H
    Dec 3, 2004
  5. Jean-Louis Leroy

    Rlogin client?

    Jean-Louis Leroy, Nov 3, 2004, in forum: Perl Misc
    Replies:
    2
    Views:
    124
    Jean-Louis Leroy
    Nov 5, 2004
Loading...

Share This Page