Expect: Getting PID at both ends of ssh

Expect: Getting PID at both ends of ssh

am 22.01.2007 21:08:09 von Ishmael

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!

Re: Expect: Getting PID at both ends of ssh

am 23.01.2007 01:26:40 von paduille.4060.mumia.w+nospam

On 01/22/2007 02:08 PM, Ishmael wrote:
> 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!
>

I don't have a lot of experience with Expect/ssh, but I think it should
be as simple as issuing "echo $$" to ssh and capturing the result.


--
Windows Vista and your freedom in conflict:
http://www.badvista.org/

Re: Expect: Getting PID at both ends of ssh

am 23.01.2007 20:57:53 von Ishmael

Worked great! Thanks a lot.