[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bash sends SIGHUP to disowned children in non-interactive mode
From: |
Philip |
Subject: |
Re: bash sends SIGHUP to disowned children in non-interactive mode |
Date: |
Wed, 28 Dec 2011 21:26:13 +0100 |
Am Wed, 28 Dec 2011 14:48:45 -0500
schrieb Greg Wooledge <wooledg@eeg.ccf.org>:
>
> If you want to disown something, you have to *stop* doing this double-fork
> nonsense.
>
> #!/bin/bash
> set -m
> xterm &
> disown -h
>
> Do not put (...) around the background job. When you do that, the main
> bash process loses its parenthood over the xterm process, so it won't be
> able to manage it.
>
> I'm not 100% sure if the set -m will be required to enable "disown" to work,
> but I'd try it that way.
>
That "double-fork nonsense" was just to ensure that the forked process was not a
child of the shell. And I still don't understand why it sends a SIGHUP to such a
process on exit. Or maybe I do now..
The 'set -m' is exactly what is needed for everything to work. Then disown works
as expected and so does the double-fork. Without 'set -m' neither of the two
ways
work properly.
I thought if the header
#!/bin/bash -i
is used that includes job management? Maybe that's the bug Stas Sergeev is
talking
about in the previous thread?
Well, thanks a lot for the input. I thought I had job management covered with
the
"-i" flag.
best regards