I cannot find a simple answer for this: I use paramiko to log in and execute several processes remotely, and I need the PID of each process to check them later. There seems to be no function in paramiko to get the PID of the executable command, so I tried using the following:
stdin,stdout,stderr = ssh.exec_command('./someScript.sh &;echo $!;)
I thought then parsing stdout would return the PID, but that is not the case. I assume I have to run the script in the background in order to have a PID (while it is running). Is there an easier, more obvious way to get the PID?
source share