同一 Monit 作业的暂存版本和生产版本

同一 Monit 作业的暂存版本和生产版本

我已将 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

但我认为进程名称必须是进程的实际名称,由脚本名称决定。

答案1

我不知道 monit(实际上从未使用过它)。也许我有点天真,但如果您已经在文件中传递了进程 pid,那么它就没有理由使用您的进程名称。

这将导致如下简单的声明:

check process delayed_job.production with pidfile ...

你已经尝试过了嗎?

相关内容