[talk] kill -0

Jan Schaumann jschauma at netmeister.org
Fri May 10 14:09:37 EDT 2019


Raul Cuza <raulcuza at gmail.com> wrote:
 
> I just had someone submit a shell script using `kill -0 ${PID}` to
> test if a process is running. It exits non-zero if ${PID} isn't a
> running process and zero otherwise. But...
> 
> http://nixdoc.net/man-pages/FreeBSD/kill.1.html says nothing about it.

kill(2) describes this behavior:

"sig may be one of the signals specified in
sigaction(2) or it may be 0, in which case error
checking is performed but no signal is actually sent.
This can be used to check the validity of pid."

-Jan



More information about the talk mailing list