I would like to detect that a certain process in linux have died.
Say that pid of that process is 1234
.
I can check that its pid is in use by testing the existence of /proc/1234/
.
Still, it is possible that the process have died and pid was reused.
I can check if the inode
of some file in proc (say proc/1234/cmdline
) is the same and hope that a new process will get a different value.
Is there any better way to reliably detect death of a process?