title: Forever not showing running processes properly
body: <p>I am writing an init script for my Node.js application that is running using forever. Forever is a daemon itself, that runs the node process under it.</p>
  
  <p>My issue is that when the Node.js application crashes, the init script does not catch that as forever always returns 0.</p>
  
  <p>I am starting forever as follows: <code>$FOREVER start --pidFile $PIDFILE -al $LOGFILE -ao $OUTFILE -ae $ERRFILE $SERVER</code></p>
  
  <p>When the Node.js startups properly and I do a list, I get:</p>
  
  <pre><code># forever list
  info:    Forever processes running
  data:        uid  command       script                                    forever pid   logfile                 uptime      
  data:    [0] UP0C /usr/bin/node /some/path/here/server.js 27322   27324 /root/.forever/UP0C.log 0:0:6:3.493
  </code></pre>
  
  <p>When it crashes, I see:</p>
  
  <pre><code># forever list
  info:    Forever processes running
  data:        uid  command       script                                    forever pid   logfile                 uptime      
  data:    [0] QFel /usr/bin/node /some/path/here/server.js 27578   27580 /root/.forever/QFel.log 0:0:1:6.207
  </code></pre>
  
  <p>As you can see, there is almost no difference. When I tail that log file shown in the output, I see the error that node throws. I'll see <code>error: Forever detected script exited with code: 8</code> at the end.</p>
  
  <p>Checking the pid of the failed Node process, I see:</p>
  
  <pre><code># ps aux | grep  27580
  root     27671  0.0  0.0 103240   840 pts/0    S+   18:37   0:00 grep 27580
  </code></pre>
  
  <p>The process is in a sleeping state. Why doesn't forever catch that and what is that process that is sleeping? Why doesn't it just exit?</p>
  
  <p>In other words, using forever, how can I detect that the process that forever tried to run failed? Why doesn't forever have an easy way to manage that? Isn't forever, in essence, designed to manage starting and stopping Node applications? Checking whether the process actually started should be one of the cornerstone features.</p>