Re: Cleaning up background processes

Liste des GroupesRevenir à cu shell 
Sujet : Re: Cleaning up background processes
De : ldo (at) *nospam* nz.invalid (Lawrence D'Oliveiro)
Groupes : comp.unix.shell
Date : 05. May 2024, 21:21:56
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v18pp3$21u38$1@dont-email.me>
References : 1
User-Agent : Pan/0.155 (Kherson; fc5a80b8)
On Sun, 5 May 2024 19:06:22 -0000 (UTC), Christian Weisgerber wrote:

You have a shell script that starts some background process with &.
Now you want to make sure that the background process terminates
when the shell script terminates.

There is no standard POSIX solution to this. There is a Linux-specific
solution, through the prctl(2) call
<https://manpages.debian.org/2/prctl.en.html>: in a child process, you
make a call with PR_SET_PDEATHSIG and specify a signal to be sent to
the child if/when the parent terminates, such as SIGKILL.

Note also the PR_SET_CHILD_SUBREAPER function: this is useful if a
child process spawns its own child and then dies; this allows the
subreaper process to get the notification when that child-of-a-child
terminates, instead of passing that buck back to pid 1.

Date Sujet#  Auteur
5 May 24 * Cleaning up background processes17Christian Weisgerber
5 May 24 +- Re: Cleaning up background processes1Lawrence D'Oliveiro
5 May 24 +- Re: Cleaning up background processes1Christian Weisgerber
6 May 24 +- Re: Cleaning up background processes1vallor
6 May 24 `* Re: Cleaning up background processes13Kaz Kylheku
6 May 24  `* Re: Cleaning up background processes12Kenny McCormack
8 May 24   +* Re: Cleaning up background processes9vallor
9 May 24   i+* Re: Cleaning up background processes4Janis Papanagnou
10 May 24   ii`* Re: Cleaning up background processes3Geoff Clare
10 May 24   ii `* Re: Cleaning up background processes2Janis Papanagnou
19 May 24   ii  `- Re: Cleaning up background processes1Martijn Dekker
11 May 24   i`* Re: Cleaning up background processes4Christian Weisgerber
11 May 24   i `* Re: Cleaning up background processes3Kenny McCormack
12 May 24   i  `* Re: Cleaning up background processes2Christian Weisgerber
13 May 24   i   `- Re: Cleaning up background processes1Geoff Clare
11 May 24   `* Re: Cleaning up background processes2Christian Weisgerber
11 May 24    `- Re: Cleaning up background processes1Kenny McCormack

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal