Expect: Getting PID at both ends of ssh



This may be more of a Unix question, but in any case, here goes. I'm
using Expect as a wrapper for 'ssh' (don't worry, I have RSA keys
enabled, so no password issues). Now, Expect provides a nice interface
for getting the PID of it's own spawned process (locally), but I would
like to get the PID at the other end of the ssh (remotely). Ideally, I
would like to get something of the form:

Local PID: 1234 (expect spawned ssh) ---> Remote PID: 5678 (shell)

How do you trace through from one end of ssh to the other? Thanks for
your help!

.



Relevant Pages

  • grab output from spawned command
    ... Way im thinking of doing it is by getting the pid of a spawned ssh ... want the whole script to fail. ... existence of a remote file so im using this connection test for 2 things). ...
    (SunManagers)
  • Re: get the pid of a process with pexpect
    ... tunnel for the duration of your script. ... PID in $! ... because SSH does not provide a way to get the PID of the tunnel if you ... start the tunnel from a shell you can't use $! ...
    (comp.lang.python)
  • Re: ssh
    ... I have an ssh key stashed already for my user ID, ... I dont understand what happens when pid does not equal 0, ... res = '' ...
    (comp.lang.python)
  • Re: [regression] nf_iterate(), BUG: unable to handle kernel NULL pointer dereference
    ... CPU 0 ... Pid: 5331, comm: ssh Not tainted 2.6.26 #21613 ...
    (Linux-Kernel)
  • PID at both ends of SSH?
    ... I'm using Expect as a wrapper for 'ssh' (don't worry, I have RSA keys ... I'm able to get the PID of the ...
    (comp.unix.misc)