unix - Linux - Handle process termination -


i need watch process known pid in linux. once terminated want execute command reason of termination.

questions

  1. how subscribe process health rather polling (e.g. watch command)?
  2. where inject event handler in os' user space?
  3. how detect termination/failure reason inside handler?

note

  • the process intend keep tab on not forked child process of parent through can monitored.
  • the process type generic (good number of them daemons)

the way kind of control on process, use ptrace(2) trace target process. use ptrace(ptrace_attach, pid) attach process, after become target process's parent (and can use wait or more ptrace calls figure out process doing).


Comments

Popular posts from this blog

ios - Is 'init' forbidden as *part* of a variable name? -

file - Python: AttributeError: 'str' object has no attribute 'readlines' -

c# - Get the Class name in a class with atribute inside a attribute method -