Deutsch English Français Italiano |
<vbul72$89jc$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Janis Papanagnou <janis_papanagnou+ng@hotmail.com> Newsgroups: comp.unix.shell Subject: Re: nohup Versus setsid Date: Thu, 12 Sep 2024 14:01:37 +0200 Organization: A noiseless patient Spider Lines: 49 Message-ID: <vbul72$89jc$1@dont-email.me> References: <vbtqcd$2sce$1@dont-email.me> <vbujqm$1t0jr$1@news.xmission.com> MIME-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Injection-Date: Thu, 12 Sep 2024 14:01:39 +0200 (CEST) Injection-Info: dont-email.me; posting-host="096a4f4876f087f313a0a9fca80aaa56"; logging-data="271980"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18SDlka3JlySDKHK2Pq8uui" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 Cancel-Lock: sha1:NH8qwP8K3QYNEgSeS9Ffp2B7TRI= In-Reply-To: <vbujqm$1t0jr$1@news.xmission.com> X-Enigmail-Draft-Status: N1110 Bytes: 3380 On 12.09.2024 13:37, Kenny McCormack wrote: > In article <vbtqcd$2sce$1@dont-email.me>, > Lawrence D'Oliveiro <ldo@nz.invalid> wrote: >> It has long seemed to me that nohup(1) was an old, hacky way of doing >> what can be done more elegantly using setsid(1). Compare the docs for >> yourself [...], and tell me why we still need nohup when we have setsid? I don't know the details, but the descriptions look quite different... nohup - run a command immune to hangups, with output to a non-tty setsid - run a program in a new session > > First, I do get what you're saying - and I've both A) Used setsid(2) a lot > over the years so am familiar with it and B) Always thought that nohup(1) > was old and crusty. I cringe whenever I hear people recommend it in help > groups nowadays. Yes it's old; existing almost from Unix' beginning (at least Version 7). But I used nohup a couple times, to have the function described above. (I've never used setsid, never needed it, didn't even know it exists.) > > That said, it is kind of apples-to-oranges comparison. nohup(1) is more of > a command, while setsid(1) is really just a thin wrapper around the system > call. According to the man page, nohup(1) does a lot of things, including > setting up logging and so on; there is no underlying system call. OTOH, to > understand setsid(1), you really have to understand the underlying system > call - and that system call is not simple. It (setsid(2)) is kind of a > "bigger/better" version of setpgrp() and it has some interesting > restrictions on its use. In a way, it could be said that both sessions and > process groups were only implemented to support shell job control, and this > is kind of a funny thing, since shell job control is now sort of thought of > as an anachronism (I still use it, but I seem to be in some kind of minority). Well, count me to the minority. But why are you saying that "job control is now sort of thought of as an anachronism"? > > So, despite what I said 2 paragraphs ago, nohup(1) may be better as a > recommendation to the newbie. A non-technical but more fundamental answer can be that nohup is POSIX standard while the other is not (with all consequences for the general case, portability, etc.). Janis