title: Monit does not start Node script
body: <p>I've installed and (hopefully) configured Monit creating a new task in <code>/etc/monit.d</code> (on CentOS 6.5)</p>
  
  <p>my task file is called <code>test</code>:</p>
  
  <pre><code>check host test with address 127.0.0.1
      start program = "/usr/local/bin/node /var/node/test/index.js" as uid node and gid node
      stop program  = "/usr/bin/pkill -f 'node /var/node/test/index.js'"
      if failed port 7000 protocol HTTP
          request /
          with timeout 10 seconds
          then restart
  </code></pre>
  
  <p>When I run:</p>
  
  <pre><code>service monit restart
  </code></pre>
  
  <p>In my monit logs appears:</p>
  
  <pre><code>[CEST Jul  4 09:50:43] info     : monit daemon with pid [21946] killed
  [CEST Jul  4 09:50:43] info     : 'nsxxxxxx.ip-xxx-xxx-xxx.eu' Monit stopped
  [CEST Jul  4 09:50:47] info     : 'nsxxxxxx.ip-xxx-xxx-xxx.eu' Monit started
  [CEST Jul  4 09:50:47] error    : 'test' failed, cannot open a connection to INET[127.0.0.1:7000] via TCP
  [CEST Jul  4 09:50:47] info     : 'test' trying to restart
  [CEST Jul  4 09:50:47] info     : 'test' stop: /usr/bin/pkill
  [CEST Jul  4 09:50:47] info     : 'test' start: /usr/local/bin/node
  </code></pre>
  
  <p>I don't understand why the script does not work, if I run it from command line with:</p>
  
  <pre><code>su node # user created for node scripts
  node /var/node/test/index.js
  </code></pre>
  
  <p>everything works correctly...</p>
  
  <p>I've followed <a href="http://blog.mixu.net/2011/01/04/nginx-php-fpm-and-node-js-install-on-centos-5-5/" rel="nofollow">this tutorial</a>.</p>
  
  <p>How can I fix this problem? Thanks</p>