Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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/delayed_job.pid
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/delayed_job.pid
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
add comment

1 Answer

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
add comment

Your Answer

 
discard

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.