[paramiko] pid of command executed on remote machine.

Robey Pointer robey at lag.net
Sun May 20 17:40:30 PDT 2007


On 4 May 2007, at 2:49, jd wrote:

> Hi everyone
>
>   I would like to  start the process on a remote node is  
> background, get its pid. How  does one do that ?
>     I am using chan.exec_command

If you know you're connecting to a unix machine, you can execute a  
shell command like:

sh -c 'echo $$; ls'

(Replace "ls" with whatever you're executing.)  That will have it  
print out the pid ("$$") before executing the command.  The SSH  
protocol doesn't otherwise expose a way to get the pid.

robey




More information about the paramiko mailing list