0

SIGCHLD can only be caught by father process to monitor if child process exits. But I wish to write a stand-alone program to monitor some processes, if they quit, report a log immediately.

Is there any programming ways that I can use, rather than using a shell "ps" command to monitor process name/id, and then query in a dead loop?

Troskyvs
  • 7,537
  • 7
  • 47
  • 115

1 Answers1

2

You can monitor process activity through proc pseudo-filesystem usually mounted at /proc. For reference use: https://www.kernel.org/doc/Documentation/filesystems/proc.txt

nopasara
  • 538
  • 3
  • 10