我已经阅读了很多关于使用 monit 监控延迟作业的内容。实现非常简单直接。但是,当一个工人不够用时,我如何设置 monit 以确保,比如说,10 个工人不断运行?
问问题
2536 次
1 回答
7
您可以为第一个工作人员复制 N 次相同的配置。假设您有 5 个工作人员,您将使用以下内容监控所有工作人员:
check process delayed_job.0
with pidfile /path/to/shared/pids/delayed_job.0.pid
start program = "/bin/su -c '/usr/bin/env RAILS_ENV=production /path/to/current/script/delayed_job -n 5 start' - user"
stop program = "/bin/su -c '/usr/bin/env RAILS_ENV=production /path/to/current/script/delayed_job stop' - user"
check process delayed_job.1
with pidfile /path/to/shared/pids/delayed_job.1.pid
start program = "/bin/su -c '/usr/bin/env RAILS_ENV=production /path/to/current/script/delayed_job -n 5 start' - user"
stop program = "/bin/su -c '/usr/bin/env RAILS_ENV=production /path/to/current/script/delayed_job stop' - user"
check process delayed_job.2
with pidfile /path/to/shared/pids/delayed_job.2.pid
start program = "/bin/su -c '/usr/bin/env RAILS_ENV=production /path/to/current/script/delayed_job -n 5 start' - user"
stop program = "/bin/su -c '/usr/bin/env RAILS_ENV=production /path/to/current/script/delayed_job stop' - user"
check process delayed_job.3
with pidfile /path/to/shared/pids/delayed_job.3.pid
start program = "/bin/su -c '/usr/bin/env RAILS_ENV=production /path/to/current/script/delayed_job -n 5 start' - user"
stop program = "/bin/su -c '/usr/bin/env RAILS_ENV=production /path/to/current/script/delayed_job stop' - user"
check process delayed_job.4
with pidfile /path/to/shared/pids/delayed_job.4.pid
start program = "/bin/su -c '/usr/bin/env RAILS_ENV=production /path/to/current/script/delayed_job -n 5 start' - user"
stop program = "/bin/su -c '/usr/bin/env RAILS_ENV=production /path/to/current/script/delayed_job stop' - user"
于 2011-05-31T13:21:15.577 回答