remote process managing

student student00 at angelfire.com
Sat Jul 17 19:49:18 EDT 2004


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 at 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



More information about the Python-list mailing list