Sujet : Re: nohup Versus setsid
De : vallor (at) *nospam* cultnix.org (vallor)
Groupes : comp.unix.shellDate : 13. Sep 2024, 00:07:07
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vbvs6r$7jlu$1@dont-email.me>
References : 1 2 3 4
User-Agent : Pan/0.160 (Toresk; f2b262f; Linux-6.11.0-rc7)
On Thu, 12 Sep 2024 22:02:10 -0000 (UTC), Lawrence D'Oliveiro wrote:
On Thu, 12 Sep 2024 14:01:37 +0200, Janis Papanagnou 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).
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
The effect is supposed to be the same: spawn a background task that will
continue running after you log out.
That's not the only thing that the (POSIX) nohup(1) tool does.
I prefer the simplicity of nohup's behavior, and use it when doing
"big" compiles.
I have a script:
$ cat go.sh
time -p make -j64
So I can:
$ nohup ./go.sh &
Then I can watch for status without flooding the terminal:
$ while : ; do tail nohup.out ; date; sleep 5 ; done
Everybody has their own way of doing things, but this works
on any POSIX system, not just Linux[*].
[*] Though, truth be told, I'm mostly using it to
compile Linux.
-- -Scott System76 Thelio Mega v1.1 x86_64 NVIDIA RTX 3090 Ti OS: Linux 6.11.0-rc7 Release: Mint 21.3 Mem: 258G "E Pluribus UNIX."