delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/07/06/17:13:37

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.1 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,T_RP_MATCHES_RCVD
X-Spam-Check-By: sourceware.org
To: cygwin AT cygwin DOT com
From: Andrew DeFaria <Andrew DOT DeFaria AT tellabs DOT com>
Subject: Re: Unable to disown process
Date: Wed, 06 Jul 2011 14:12:52 -0700
Lines: 36
Message-ID: <iv2j4l$sqa$1@dough.gmane.org>
References: <iv25no$u76$1 AT dough DOT gmane DOT org> <CAHWeT-YB1RV+zXtM1+EnNvKVyymsj9BqYHrGe2nEPM25oL+Ypw AT mail DOT gmail DOT com> <iv2fog$69i$1 AT dough DOT gmane DOT org> <CAHWeT-bGKZk9EyT2W-9piwcVy+4xTKVf9kqcvY7B0FURdY4WEQ AT mail DOT gmail DOT com>
Mime-Version: 1.0
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.18) Gecko/20110616 Lightning/1.0b2 Thunderbird/3.1.11
In-Reply-To: <CAHWeT-bGKZk9EyT2W-9piwcVy+4xTKVf9kqcvY7B0FURdY4WEQ@mail.gmail.com>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT 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

On 7/6/2011 2:01 PM, Andy Koppe wrote:
> On 6 July 2011 21:15, Andrew wrote:
>> On 7/6/2011 12:12 PM, Andy Koppe wrote:
>>> You can use the 'setsid' utility from the util-linux package to invoke
>>> a program in its own session, i.e. without connection to the terminal
>>> it is invoked from. For example:
>>>
>>> setsid ssh -NL 1119:news.mozilla.org:119 \
>>>           -L 2119:news.gmane.org:119 \
>>>           -L 3119:nntp.perl.org:119 \
>>>           andrew AT defaria DOT com
>>>
>>> No need for 'nohup', redirections, backgrounding, or 'disown' with this.
>> Actually I still need backgrounding as without it my ~/bin/tunnel just hangs
>> on the setsid command...
> Hmm, I'm afraid I don't know why that happens when setsid is invoked
> from a script.
>
> This returns immediately:
>
> $ setsid sleep 10
>
> As does this:
>
> $ bash -c 'setsid sleep 10'
>
> But this doesn't:
>
> $ echo 'setsid sleep 10'>  sleep.sh; bash sleep.sh
>
> Andy
The above coincides with my experiments too. Not a big deal as adding a 
"&" to the line in the script works just fine.
-- 
Andrew DeFaria <http://defaria.com>
If croutons are stale bread, why do they come in airtight packages?


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

- Raw text -


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