On Sun, Aug 15, 2021 at 07:23:53PM +0200, Claus Assmann wrote:
> On Sun, Aug 15, 2021, Andreas Kusalananda Khri wrote:
> 
> > wait returns 127 if the process is not a child of the current shell.
> > Is it a child process of the current shell?  If so, does it install a
> 
> Yes, indirectly via 2-3 sh scripts.

Yeah, that won't work. wait only works for child processes of the
current shell, not for grand-child processes etc.

> > signal handler for the HUP signal?
> 
> Yes, the "usual" one for a multi-threaded process: one thread which
> handles signals and sends a single byte via a pipe to another thread
> which then (hopefully) does the appropriate thing.
> 
> So it seems better to use kill -0 PID to see whether the process
> still exists.

Yes, if you have the PID for it, otherwise pkill -0 with the apropriate
options and pattern to pick the correct process out.

-- 
Andreas (Kusalananda) Kähäri
SciLifeLab, NBIS, ICM
Uppsala University, Sweden

.

Reply via email to