I need to find pid of proccess started in bash script with another program. I use sshpass to enter the password, sshpass start ssh client and that client open sshtunnel to server. Here is examples:
start_tunnel.sh
#!/bin/bash
exec sshpass -p 'passw' ssh -D :port user@$server -o StrictHostKeyChecking=no -f -N
exit
And I start it with subrocess.Popen:
proc = subprocess.Popen('start_tunnel.sh')
The script start just fine, it normally finish and return 0, I can get it PID, but is it possible to get the PID of started sshclient?