delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/04/09/17:51:44

X-Spam-Check-By: sourceware.org
Message-ID: <15a6d6ee0704091451n34da54dciba802b5bcc04af62@mail.gmail.com>
Date: Mon, 9 Apr 2007 17:51:24 -0400
From: "Ken Shaffer" <strobelight DOT audio AT gmail DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: 1.5.24: rxvt or console fail to shutdown due to ssh -f still running despite setsid()
MIME-Version: 1.0
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

> I have just checked the source for the daemon() function and the setsid executable. They
> both call fork() and then setsid(). Do the console/rxvt process stick after calling ssh -f
> because file descriptors are left open? Can you suggest a strategy to deal with this?

I'm not running ssh as a daemon. What I do in order to ssh to another
computer from any other shell is to keep one shell open all the time
running the agent. This is accomplished via the startssh function. In
the function I alias exit to call the stopssh function assuming of
course that this shell is the last to close.  My rxvt closes just fine
this way. You only want to startssh one time. The alias ssh then
sources in the current agent information and calls the real ssh.

startssh()
{
    KSAGENT="`type ssh-agent 2>/dev/null|sed 's/.* is //'`"
    if [ -n "$KSAGENT" ]; then
        ssh-agent |sed '/echo Agent pid/d' > $HOME/.ssh/current_agent
        source $HOME/.ssh/current_agent
        ssh-add
        PROMPT_COMMAND='echo -n -e "\033]0;SSH-AGENT Started! $PWD\007"'
        alias exit='stopssh;exit'
    fi
}

stopssh()
{
    eval `ssh-agent -k`
}

alias ssh="source $HOME/.ssh/current_agent;ssh"

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019