I'm trying to use Monit to watch a Thin Rails application server process. Here is my Monit config:
check process thin-3000
with pidfile /var/www/apps/myapp/shared/pids/thin.3000.pid
start program = "/bin/su - deploy -c 'thin start -C /etc/thin/myapp.yml -o 3000'"
stop program = "/bin/su - deploy -c 'thin stop -C /etc/thin/myapp.yml -o 3000'"
if failed port 3000 then restart
group thin
This actually works. If I kill the Thin server process, Monit will faithfully restart it. However, if I watch the Monit log it keeps outputting the following over and over again:
[UTC Jan 14 23:01:04] error : 'thin-3000' process is not running
[UTC Jan 14 23:01:04] info : 'thin-3000' trying to restart
[UTC Jan 14 23:01:04] info : 'thin-3000' start: /bin/su
[UTC Jan 14 23:01:34] error : 'thin-3000' failed to start
It looks like whatever mechanism it's using to check if the process is running isn't working correctly. Do you know what I might be doing wrong?