Ruby-on-Rails

同一 Monit 作業的暫存和生產版本

  • August 27, 2009

我已將monit 配置為監視我的應用程序生產版本的作業:

# 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"

我還想在同一個盒子上監控暫存版本,但我不太清楚我想做的事情是否被允許。我的第一個猜測只是做一個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"

但現在我有兩個名為“delayed_job”的程序。我怎樣才能告訴monit啟動和停止哪個?我希望能夠做類似的事情

monit start delayed_job.production

但我認為程序名稱必須是程序的實際名稱,由腳本名稱確定。

我不知道monit(實際上從未使用過)。也許我有點天真,但是如果您已經在文件中傳遞了程序 pid,那麼它沒有理由使用您的程序名稱。

這將導致一個簡單的聲明:

check process delayed_job.production with pidfile ...

你已經嘗試過了嗎?

引用自:https://serverfault.com/questions/59513