Click here to get back home

Expect: Getting PID at both ends of ssh

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Expect: Getting PID at both ends of ssh Ishmael 01-22-2007
Posted by Ishmael on January 22, 2007, 3:08 pm
Please log in for more thread options


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!


Posted by Mumia W. (NOSPAM) on January 22, 2007, 7:26 pm
Please log in for more thread options


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/

Posted by Ishmael on January 23, 2007, 2:57 pm
Please log in for more thread options


Worked great! Thanks a lot.


Similar ThreadsPosted
Expect - "sleep" executed at the wrong time (before an expect(... send...) instead of after) September 18, 2008, 4:58 am
Start an Event when a Session ends December 20, 2004, 5:57 pm
DBI does not do what I expect... March 12, 2008, 4:18 am
using Net::SSH::Perl with Expect November 21, 2005, 3:41 pm
Expect::Simple December 1, 2005, 4:19 pm
Expect::Simple December 2, 2005, 9:22 am
Expect and xterm February 27, 2007, 11:12 pm
Perl Expect question November 8, 2004, 12:20 pm
username passwd expect September 14, 2006, 12:36 am
Simple expect problem . March 21, 2007, 2:31 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap