This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Unable to disown process


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@defaria.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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]