title: An easy way to detect if a process crashed (or stopped)?
body: <p>I need to detect if a process stopped (doesn't matter if crashed, exited normally, or anything else).</p>
  
  <p>My setup is like this :
  - task A - does some processing (and occasionally crashes).<br>
  - task B - starts the task A, and waits for results  </p>
  
  <p>My idea is to open a file in task A right at the beginning, and to use <a href="http://linux.die.net/man/7/inotify" rel="nofollow">inotify</a> in task B to detect when task A opened and closed the file. When task A stops (normally or crash), the file will be closed, and task B will detect this.
  (when task A crashes, the file will be closed, right?)</p>
  
  <p>My questions are :<br>
  - Is the above going to work?<br>
  - Is there a simpler or better way to detect task A stopping?  </p>
  
  <p>PS If it matters, I am using fedora 9</p>
  
  <p><strong>EDIT</strong>
  The setup above is very simplified. I have 2 of task B, and about 30 of task A. Therefore, I can not use <code>system</code> and <code>fork</code></p>