Re: get the pid of a process with pexpect

2008-05-06 Thread Karim Bernardet
Many thanks ! This is what I did for mytunnel.py : I use pexpect like this tunnel_command = '''bash -c "ssh -N -R 60011:localhost:60002 [EMAIL PROTECTED] "''' com="echo \""+str(ssh_tunnel.pid)+"\" >> pids" ... time.sleep(172800) in the bash script which calls mytunnel.py : ./mytunnel.py $

Re: get the pid of a process with pexpect

2008-05-05 Thread Noah
On May 5, 7:18 am, Karim Bernardet <[EMAIL PROTECTED]> wrote: > ssh_tunnel = pexpect.spawn (tunnel_command % globals()) > ... > print ssh_tunnel.pid > > but ssh_tunnel is not the pid of the ssh tunnel > > Is there a way to get it using pexpect ? You will notice that you can't get this information

Re: get the pid of a process with pexpect

2008-05-05 Thread Nick Craig-Wood
Karim Bernardet <[EMAIL PROTECTED]> wrote: > Hi > > I am using pexpect to do ssh tunneling and to open a vnc server (jobs on > a grid cluster). When the job is canceled, these 2 processes remain on > the worker node (they are detached), so I have to kill them (using a > trap command in the