Sujet : Re: nohup Versus setsid
De : 643-408-1753 (at) *nospam* kylheku.com (Kaz Kylheku)
Groupes : comp.unix.shellDate : 13. Sep 2024, 02:37:54
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <20240912173141.563@kylheku.com>
References : 1 2 3 4 5
User-Agent : slrn/pre1.0.4-9 (Linux)
On 2024-09-12, vallor <
vallor@cultnix.org> wrote:
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[*].
I have this:
$ time -p make -j64 | pw &
Where pw is PipeWatch:
https://www.kylheku.com/cgit/pw/about/pw continuously reads its input, and refreshes the terminal
with samples of the input.
When pw is put into the job control background, it knows this,
and avoids writing to the terminal, while continuing to read
standard input, and performing its activities like capturing
triggered snapshots.
When you foreground it, the display refreshes.
pw is not a pager; it does not buffer everything and does not
let you scroll through the history. It captures terminal-window-sized
snapshots consisting of lines.
-- TXR Programming Language: http://nongnu.org/txrCygnal: Cygwin Native Application Library: http://kylheku.com/cygnalMastodon: @Kazinator@mstdn.ca