Deutsch   English   Français   Italiano  
<83wmjf1oaq.fsf@helmutwaitzmann.news.arcor.de>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!3.eu.feeder.erje.net!feeder.erje.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Helmut Waitzmann <nn.throttle@xoxy.net>
Newsgroups: comp.unix.shell
Subject: Re: nohup Versus setsid
Date: Fri, 13 Sep 2024 19:00:45 +0200
Organization: A noiseless patient Spider
Lines: 38
Sender: Helmut Waitzmann <12f7e638@mail.de>
Message-ID: <83wmjf1oaq.fsf@helmutwaitzmann.news.arcor.de>
References: <vbtqcd$2sce$1@dont-email.me>
Reply-To: Helmut Waitzmann Anti-Spam-Ticket.b.qc3c <oe.throttle@xoxy.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: quoted-printable
Injection-Date: Fri, 13 Sep 2024 19:12:41 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="f0e4ad89130e009d4e5de0b67c768f97";
	logging-data="1031086"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/WbR7VAku8dOOXgjAcbVYL33FtLXbXT9E="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:ev8Ee13zg/1/KH4/auso94q9weo=
	sha1:NeCp51oKjb3wBf+Ze+qQawg2Lz0=
Mail-Reply-To: Helmut Waitzmann Anti-Spam-Ticket.b.qc3c <oe.throttle@xoxy.net>
Mail-Copies-To: nobody
Bytes: 2862

 Lawrence D'Oliveiro <ldo@nz.invalid>:
> It has long seemed to me that nohup(1) was an old, hacky way of=20
> doing what can be done more elegantly using setsid(1). Compare=20
> the docs for yourself=20
> <https://manpages.debian.org/1/nohup.1.en.html> vs=20
> <https://manpages.debian.org/1/setsid.1.en.html>, and tell me=20
> why we still need nohup when we have setsid?=20
>

 Because there is a real difference between both of them.=20


 "nohup" makes the invoked command immune to the HUP signal but=20
 lets it remain in its terminal session, i.=E2=80=AFe.=C2=A0the command to =
be=20
 run will not lose its controlling terminal.=C2=A0 Thus the other job=20
 control signals like TSTP, INT, and QUIT sent by the terminal=20
 driver to the command may have their effects.=20


 Also, the HUP signal will be ignored regardless of its origin=20
 (terminal driver as well as the "kill(2)" system call).=20


 If, on the other hand, you use "setsid", the command to be run=20
 will not be made immune to any of the job control signals,=20
 i.=E2=80=AFe.=C2=A0any job control signal sent to the command to be run by=
=20
 means of the kill(2) system call will have its effect.=20


 Also, as the command to be run will leave the terminal session=20
 and thus lose the controlling terminal of the invoker, it won't=20
 be affected by any job control signal sent by the terminal driver=20
 of the invoker's controlling terminal, for example when typing=20
 the interrupt, suspend or quit key on the keyboard no signal will=20
 reach the command to be invoked.=20