我已将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 ...
你已经尝试过了吗?