title: Monit logs running process as server not running
body: <p>I'm trying to monitor my server and just want to restart it when its down. Following is my monit control </p>
  
  <pre><code>check process myserver with pidfile "/home/path/to/myserver.pid"
  start program = "/etc/init.d/myserver start"
  stop program = "/etc/init.d/myserver stop"
  if failed host 127.0.0.1 port 8080 protocol http
  then restart
  </code></pre>
  
  <p>But even if the server is running monit gives error like:</p>
  
  <pre><code>'myserver' process not running
  trying to restart 'myserver'
  failed to restart myserver.
  </code></pre>
  
  <p>How do I fix this? Am I making some mistakes?</p>
  
  <p>Also when I try to use 'send' and 'expect' it gives error like</p>
  
  <pre><code>Erro: syntax error 'send'.
  </code></pre>