пʼятниця, 5 березня 2010 р.

Using monit to watch delayed_job on rails

I've been fighting for some time to successfully start/stop the delayed_job deamon ('daemons' gem) via monit from under another user and this is what I've ended up with:

check process delayed_job with pidfile /home/me/myapp/shared/pids/job_runner.pid
start program = "/usr/bin/env HOME=/home/me RAILS_ENV=staging /home/me/myapp/current/script/delayed_job start" as uid me and gid mygroup
stop program = "/usr/bin/env HOME=/home/me RAILS_ENV=staging /home/me/myapp/current/script/delayed_job stop" as uid me and gid mygroup