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.