title: Monit: program is timed out
body: <p>Monit after 5.8.1 starts to log time-out error when I try to run a script which enters an infinite loop. But after a while it suddenly notices that the script really runs. How to avoid this nasty error?</p>
  
  <h2>move-data.pl</h2>
  
  <pre><code>**#!/usr/bin/perl
  
  while(1)
  {.
    print "!\n";
    sleep 1;
  }**
  </code></pre>
  
  <h2>monit.conf:</h2>
  
  <pre><code>check process move-data matching "move-data.pl"
    start program = "/home/volcanodev/move-data"
    stop program = "/usr/bin/pkill -f move-data.pl"
  </code></pre>
  
  <h2>move-data</h2>
  
  <pre><code>#!/bin/bash
  cd /var/opt/poller
  # Just run a script with an infinite loop. The script does not stop
  /usr/bin/perl move-data.pl --config=sha
  </code></pre>
  
  <h2>monit.log</h2>
  
  <pre><code>Jun 10 12:29:04 billing monit[386]: 'move-data' trying to restart
  Jun 10 12:29:04 billing monit[386]: 'move-data' stop: /usr/bin/pkill
  Jun 10 12:29:04 billing monit[386]: 'move-data' start: /bin/sh
  Jun 10 12:29:34 billing monit[386]: 'move-data' failed to start (exit status -1) -- Program /bin/sh timed out
  Jun 10 12:29:34 billing monit[386]: 'move-data' restart action done
  Jun 10 12:30:04 billing monit[386]: 'move-data' process is running after previous exec error (slow starting or manually recovered?)
  </code></pre>
  
  <p>The same if I try to start program without bash file </p>
  
  <pre><code>start program = "/usr/bin/perl move-data.pl --config=sha"
  </code></pre>
  
  <p>and if I try to start the same program with a pid file instead of a process name matching (changing the script to create a pid file, of course)</p>
  
  <pre><code>check process move-data with pidfile /tmp/move-data.pid
  </code></pre>