* Re: Really detaching jobs
2015-10-02 14:38 ` Dominik Vogt
@ 2015-10-02 15:08 ` Bart Schaefer
2015-10-02 17:15 ` covici
2015-10-02 18:45 ` Mikael Magnusson
2 siblings, 0 replies; 7+ messages in thread
From: Bart Schaefer @ 2015-10-02 15:08 UTC (permalink / raw)
To: vogt, Zsh Users
On Fri, Oct 2, 2015 at 7:38 AM, Dominik Vogt <vogt@linux.vnet.ibm.com> wrote:
>
>
> Yeah, but if I had known *in advance* that I'd have the problem,
> I'd just have used nohup. So the question is really how to detach
> a running process group from the controlling terminal, and whether
> zsh can help with that in any way (which I guess it cannot).
>
Chances are that the reason the process dies is because sshd has
closed the standard output (the terminal) so it gets a write error.
The only reliable way to detach something is to redirect its outputs
(and inputs), which nohup does. Once the process is running, there's
(generally) no external way to change those file descriptors, the
shell can't do anything after the fact.
The advantage of something like "screen" is that if you ALWAYS use it,
you can stop worrying about knowing in advance.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Really detaching jobs
2015-10-02 14:38 ` Dominik Vogt
2015-10-02 15:08 ` Bart Schaefer
@ 2015-10-02 17:15 ` covici
2015-10-02 18:45 ` Mikael Magnusson
2 siblings, 0 replies; 7+ messages in thread
From: covici @ 2015-10-02 17:15 UTC (permalink / raw)
To: zsh-users
Dominik Vogt <vogt@linux.vnet.ibm.com> wrote:
> On Fri, Oct 02, 2015 at 09:43:58PM +0900, Jun T. wrote:
> >
> > 2015/10/02 20:56, Dominik Vogt <vogt@linux.vnet.ibm.com> wrote:
> >
> > > Is there a way to *really* detach the job so that it will complete
> > > if I close the terminal emulator or kill the ssh connection?
> >
> > You may try GNU screen: https://www.gnu.org/software/screen/
> > It has a "detach" command, which is exactly what you want.
>
> Yeah, but if I had known *in advance* that I'd have the problem,
> I'd just have used nohup. So the question is really how to detach
> a running process group from the controlling terminal, and whether
> zsh can help with that in any way (which I guess it cannot).
>
I just always use tmux and zsh and so if there is a disconnect, its good
to go. Tmusx is just a better version of screen.
--
Your life is like a penny. You're going to lose it. The question is:
How do
you spend it?
John Covici
covici@ccs.covici.com
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Really detaching jobs
2015-10-02 14:38 ` Dominik Vogt
2015-10-02 15:08 ` Bart Schaefer
2015-10-02 17:15 ` covici
@ 2015-10-02 18:45 ` Mikael Magnusson
2015-10-05 6:52 ` Dominik Vogt
2 siblings, 1 reply; 7+ messages in thread
From: Mikael Magnusson @ 2015-10-02 18:45 UTC (permalink / raw)
To: vogt, Zsh Users
On Fri, Oct 2, 2015 at 4:38 PM, Dominik Vogt <vogt@linux.vnet.ibm.com> wrote:
> On Fri, Oct 02, 2015 at 09:43:58PM +0900, Jun T. wrote:
>>
>> 2015/10/02 20:56, Dominik Vogt <vogt@linux.vnet.ibm.com> wrote:
>>
>> > Is there a way to *really* detach the job so that it will complete
>> > if I close the terminal emulator or kill the ssh connection?
>>
>> You may try GNU screen: https://www.gnu.org/software/screen/
>> It has a "detach" command, which is exactly what you want.
>
> Yeah, but if I had known *in advance* that I'd have the problem,
> I'd just have used nohup. So the question is really how to detach
> a running process group from the controlling terminal, and whether
> zsh can help with that in any way (which I guess it cannot).
This may work with varying degrees of success, https://github.com/nelhage/reptyr
--
Mikael Magnusson
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Really detaching jobs
2015-10-02 18:45 ` Mikael Magnusson
@ 2015-10-05 6:52 ` Dominik Vogt
0 siblings, 0 replies; 7+ messages in thread
From: Dominik Vogt @ 2015-10-05 6:52 UTC (permalink / raw)
To: Zsh Users
On Fri, Oct 02, 2015 at 08:45:21PM +0200, Mikael Magnusson wrote:
> On Fri, Oct 2, 2015 at 4:38 PM, Dominik Vogt <vogt@linux.vnet.ibm.com> wrote:
> > 2015/10/02 20:56, Dominik Vogt <vogt@linux.vnet.ibm.com> wrote:
> > Is there a way to *really* detach the job so that it will complete
> > if I close the terminal emulator or kill the ssh connection?
>
> This may work with varying degrees of success, https://github.com/nelhage/reptyr
That's what I was looking for.
$ reptyr PID > /dev/null 2>&1
does the trick. Thanks!
Ciao
Dominik ^_^ ^_^
--
Dominik Vogt
IBM Germany
^ permalink raw reply [flat|nested] 7+ messages in thread