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

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -