Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have monit configured to monitor a job for the production version of my application:

# in /etc/monitrc:
include /etc/monit/delayed_job.my_app.production.monitrc

# in /etc/monit/delayed_job.my_app.production.monitrc
check process delayed_job with pidfile /var/www/apps/myapp_production/shared/pids/
start program = "/var/www/apps/myapp_production/current/script/delayed_job -e production start"
stop program = "/var/www/apps/myapp_production/current/script/delayed_job -e production stop"

I'd like to also monitor the staging version on the same box, but I can't quite figure out whether what I want to do is allowed. My first guess was just to do a gsub/production/staging:

# in /etc/monitrc:
include /etc/monit/delayed_job.my_app.staging.monitrc

# in /etc/monit/delayed_job.my_app.staging.monitrc:
check process delayed_job with pidfile /var/www/apps/myapp_staging/shared/pids/
start program = "/var/www/apps/myapp_staging/current/script/delayed_job -e staging start"
stop program = "/var/www/apps/myapp_staging/current/script/delayed_job -e staging stop"

But now I have two processes named "delayed_job." How can I tell monit which one to start and stop? I want to be able to do something like

monit start delayed_job.production

but I think that process name has to be the actual name of the process, which is determined by the script name.

share|improve this question
up vote 2 down vote accepted

I don't know monit (never used it in fact). Maybe I'm a little bit naive but if you are already passing the process pid in a file, there is no reason for it to use your process name.

That would lead to a declaration as simple as:

check process delayed_job.production with pidfile ...

Did you already give it a try?

share|improve this answer
I thought of that but totally expected it to bomb. To my surprise, success! – James A. Rosen Aug 27 '09 at 12:54

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.