delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/06/11/13:03:16

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/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
Message-ID: <006601c3303b$4cd0c560$78d96f83@pomello>
From: "Max Bowsher" <maxb AT ukf DOT net>
To: <matt AT mattflo DOT com>, <cygwin AT cygwin DOT com>
References: <20030611165402 DOT 38063 DOT qmail AT web14903 DOT mail DOT yahoo DOT com>
Subject: Re: Processes are unable to fully discard their controlling terminal
Date: Wed, 11 Jun 2003 18:02:54 +0100
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
X-Cam-ScannerAdmin: mail-scanner-support AT ucs DOT cam DOT ac DOT uk
X-Cam-AntiVirus: Not scanned
X-Cam-SpamDetails:

------=_NextPart_000_0063_01C33043.AE5CB840
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

Some time ago I (Max Bowsher) wrote:
> I can now successfully share an ssh-agent between all
> my shells, with it
> starting with the first one, and ending with the last,
> and no zombie windows
> if I end shells in the wrong order.

Matt wrote:
> I would like ssh-agent to function like you say it is
> for you... but i can't understand what you did besides
> obtain the latest versions which i should have..  what
> else do i need to do?

Some shell scripting.

Attached are the shell scripts I *source* from my .bash_profile and
.bash_logout.

It's not a perfect system (if a shell is killed in such a way that
.bash_logout doesn't execute, an agent process can remain), but it seems to
work well for the most part.



Max.

------=_NextPart_000_0063_01C33043.AE5CB840
Content-Type: application/octet-stream;
	name="agent_refcount_start"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="agent_refcount_start"

#########################################################################=
#######=0A=
# vim:ft=3Dsh:sw=3D2:=0A=
=0A=
if [ -x "`type -p ssh-agent`" ]; then=0A=
=0A=
  SESSION_ID=3D${1:-$$}=0A=
  SSH_ENV=3D"$HOME/.ssh/environment"=0A=
  SSH_ENV_LOCK=3D"${SSH_ENV}.inuseby.${SESSION_ID}"=0A=
  SSH_ENV_LOCK_PATTERN=3D"${SSH_ENV}.inuseby.*"=0A=
=0A=
  function start_agent=0A=
  {=0A=
    rm -f "${SSH_ENV}"=0A=
    echo -n "Initialising new SSH agent... "=0A=
    ssh-agent > "${SSH_ENV}"=0A=
    . "${SSH_ENV}"=0A=
    rm -f ${SSH_ENV_LOCK_PATTERN}=0A=
    touch "${SSH_ENV_LOCK}"=0A=
  }=0A=
=0A=
  # Source SSH settings, if applicable=0A=
=0A=
  if [ -f "${SSH_ENV}" ]; then=0A=
    echo -n "Connecting with running SSH agent... "=0A=
    . "${SSH_ENV}"=0A=
    if kill -0 "${SSH_AGENT_PID}"; then=0A=
      touch "${SSH_ENV_LOCK}"=0A=
    else=0A=
      start_agent=0A=
    fi=0A=
  else=0A=
    start_agent=0A=
  fi=0A=
=0A=
  echo=0A=
=0A=
fi=0A=
=0A=
#########################################################################=
#######=0A=

------=_NextPart_000_0063_01C33043.AE5CB840
Content-Type: application/octet-stream;
	name="agent_refcount_stop"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="agent_refcount_stop"

#########################################################################=
#######=0A=
# vim:ft=3Dsh:sw=3D2:=0A=
=0A=
if [ -x "`type -p ssh-agent`" ]; then=0A=
=0A=
  SSH_ENV=3D"$HOME/.ssh/environment"=0A=
  SSH_ENV_LOCK=3D"${SSH_ENV}.inuseby.$$"=0A=
  SSH_ENV_LOCK_PATTERN=3D"${SSH_ENV}.inuseby.*"=0A=
=0A=
  if [ -a "${SSH_ENV_LOCK}" ]; then=0A=
    rm -f "${SSH_ENV_LOCK}"=0A=
    shopt -s nullglob=0A=
    if [ -z "`eval echo "${SSH_ENV_LOCK_PATTERN}"`" ]; then=0A=
      eval `ssh-agent -k`=0A=
      rm -f "${SSH_ENV}"=0A=
    fi=0A=
  fi=0A=
=0A=
fi=0A=
=0A=
#########################################################################=
#######=0A=


------=_NextPart_000_0063_01C33043.AE5CB840
Content-Type: text/plain; charset=us-ascii

--
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/
------=_NextPart_000_0063_01C33043.AE5CB840--

- Raw text -


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