Problems with rlogin and executing a script

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Lukas Schnieper

    Problems with rlogin and executing a script

    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("rlog in <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?


  • Dennis Lee Bieber

    #2
    Re: Problems with rlogin and executing a script

    Lukas Schnieper fed this fish to the penguins on Wednesday 01 October
    2003 12:59 am:
    [color=blue]
    >
    > os.system("rlog in <hostname>")
    > os.system("./myscript.py")
    >[/color]
    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.
    [color=blue]
    > 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?
    >[/color]
    Check the various popen family. Though you may have to write the
    entire sequence first before you can read the returns...

    --[color=blue]
    > =============== =============== =============== =============== == <
    > wlfraed@ix.netc om.com | Wulfraed Dennis Lee Bieber KD6MOG <
    > wulfraed@dm.net | Bestiaria Support Staff <
    > =============== =============== =============== =============== == <
    > Bestiaria Home Page: http://www.beastie.dm.net/ <
    > Home Page: http://www.dm.net/~wulfraed/ <[/color]

    Comment

    • Richard

      #3
      Re: Problems with rlogin and executing a script

      Lukas Schnieper <schnieper@sema for.ch> wrote in message news:<mailman.1 064994842.25014 .python-list@python.org >...[color=blue]
      > 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("rlog in <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?[/color]

      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.

      Comment

      Working...