Execute a script on a remote machine

2008-06-20 Thread srinivasan srinivas
Hi,
My requirement is i have to execute a python script on a remote machine as a 
subprocess from a python script and to get the subprocess pid of the process 
running the script. Is there anyway to do that??
I have used subprocess.popen() method to do that. I have done as following:
executable = '/usr/bin/rsh'
args = [executable, hostname, scriptname]
pid = subprocess.popen(args)
It returned the pid of rsh. But i am interested in the pid of the process 
running the script.
Can anyone help me out here?
Thanks,
Srini


  Unlimited freedom, unlimited storage. Get it now, on 
http://help.yahoo.com/l/in/yahoo/mail/yahoomail/tools/tools-08.html/
--
http://mail.python.org/mailman/listinfo/python-list


Re: Execute a script on a remote machine

2008-06-20 Thread Gerhard Häring

srinivasan srinivas wrote:

Hi,
My requirement is i have to execute a python script on a remote machine as a 
subprocess from a python script and to get the subprocess pid of the process 
running the script. Is there anyway to do that??
I have used subprocess.popen() method to do that. I have done as following:
executable = '/usr/bin/rsh'
args = [executable, hostname, scriptname]
pid = subprocess.popen(args)
It returned the pid of rsh. But i am interested in the pid of the process 
running the script.
Can anyone help me out here?


Using os.getpid() you can find out the pid of the script and communicate 
it back to the caller.


-- Gerhard

--
http://mail.python.org/mailman/listinfo/python-list


Re: Execute a script on a remote machine

2008-06-20 Thread srinivasan srinivas
This is ok. 
Is there any other way to find it out?
Thanks,
Srini

- Original Message 
From: Gerhard Häring [EMAIL PROTECTED]
To: python-list@python.org
Sent: Friday, 20 June, 2008 10:03:30 PM
Subject: Re: Execute a script on a remote machine

srinivasan srinivas wrote:
 Hi,
 My requirement is i have to execute a python script on a remote machine as a 
 subprocess from a python script and to get the subprocess pid of the process 
 running the script. Is there anyway to do that??
 I have used subprocess.popen() method to do that. I have done as following:
 executable = '/usr/bin/rsh'
 args = [executable, hostname, scriptname]
 pid = subprocess.popen(args)
 It returned the pid of rsh. But i am interested in the pid of the process 
 running the script.
 Can anyone help me out here?

Using os.getpid() you can find out the pid of the script and communicate 
it back to the caller.

-- Gerhard

--
http://mail.python.org/mailman/listinfo/python-list



  Save all your chat conversations. Find them online at 
http://in.messenger.yahoo.com/webmessengerpromo.php
--
http://mail.python.org/mailman/listinfo/python-list


Re: Execute a script on a remote machine

2008-06-20 Thread Gerhard Häring
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

srinivasan srinivas wrote:
 Is there any other way rather than communicating back to the caller?

No, the remote PID isn't magically transferred via RSH. The remote
script must communicate the PID back.

Just writing it remotely as first line and on the client side reading
the first line via the subprocess module could do the trick.

- -- Gerhard
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIXAZFdIO4ozGCH14RAoGIAJ4jiEc/389uzBPkRWVMQJnJSEOM6ACfQ0ra
UXbXtTl6StW62Xq5MyD7+Yw=
=S4XS
-END PGP SIGNATURE-
--
http://mail.python.org/mailman/listinfo/python-list