remote process managing

Discussion in 'Python' started by student, Jul 18, 2004.

  1. student

    student Guest

    Hi,

    I am working on a project where I need to start processes on remote
    machines, across mac, linux, windows from one server or 'manager'
    machine.

    For now, I only need to implement a 'wait' type command , so I can
    wait for the remote machine to finish, everything is synchronized in
    this respect.

    I'm not sure the best way to do this. Currently, I will do a
    popen2.Popen4 command to start the ssh command, example:

    ssh user@hostname command arg1 arg2 ...

    Then I do a Popen4.poll() and wait for it to finish.

    The problem is if the process hangs, I can't end it. So I created a
    python script on the remote machine (which i call in the ssh command)
    which does a os.spawnv on the command, then i create a socket to send
    its process id over. Once I receive it I can poll and if it takes too
    long kill the remote pid, and my ssh session.

    But, is there an easier way to do this? ssh is capturing the stdout,
    stderr streams from the other process. Maybe I can create some type
    of shared file instead? Any suggestions?

    Thanks,
    student
     
    student, Jul 18, 2004
    #1
    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. davidj411
    Replies:
    7
    Views:
    3,282
    Tim Golden
    Oct 8, 2009
  2. Tim Chandler
    Replies:
    0
    Views:
    218
    Tim Chandler
    Oct 7, 2003
  3. Dirc
    Replies:
    1
    Views:
    403
  4. Jeff Wood
    Replies:
    7
    Views:
    198
    Jeff Wood
    Oct 18, 2005
  5. Markus Arike
    Replies:
    2
    Views:
    101
    Markus Arike
    Aug 19, 2008
Loading...

Share This Page