我正在尝试使用 monit 运行delayed_job,但它无法运行,因为 rvm 的路径(每个用户的本地 rvm 安装)对该命令不可用。我的应用程序是一个带有捆绑器的rails2应用程序。 Monit 无法找到捆绑程序。有人对我如何了解 monit 的 rvm 路径有任何建议吗?
我收到错误
[rails@x-rws1 current]$ monit start delayed_job -c config/delayed_job.monitrc
'delayed_job' start: /usr/bin/env
'delayed_job' failed to start
no such file to load -- bundler
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
/home/rails/public_html/myapp/current/config/../config/preinitializer.rb:3
/home/rails/public_html/myapp/current/config/boot.rb:28:in `load'
/home/rails/public_html/myapp/current/config/boot.rb:28:in `preinitialize'
/home/rails/public_html/myapp/current/config/boot.rb:10:in `boot!'
/home/rails/public_html/myapp/current/config/boot.rb:123
/home/rails/public_html/myapp/current/config/environment.rb:12:in `require'
/home/rails/public_html/myapp/current/config/environment.rb:12
/home/rails/public_html/myapp/current/script/delayed_job:3:in `require'
/home/rails/public_html/myapp/current/script/delayed_job:3
我的配置/delayed_job.monitrc
set daemon 120
check process delayed_job with pidfile /home/rails/public_html/myapp/shared/pids/delayed_job.pid
start program = "/usr/bin/env RAILS_ENV=staging /home/rails/public_html/myapp/current/script/delayed_job start"
stop program = "/usr/bin/env RAILS_ENV=staging /home/rails/public_html/myapp/current/script/delayed_job stop"
和 script/delayed_job 可执行文件
#!/usr/bin/env ruby
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'config', 'environment'))
require 'delayed/command'
Delayed::Command.new(ARGV).daemonize
“rvm -S”对我不起作用。
有关说明http://matthew.mceachen.us/blog/howto-make-system-wide-rvm-installations-work-with-cron-monit-delayed_job-and-passenger-1021.html http://matthew.mceachen.us/blog/howto-make-system-wide-rvm-installations-work-with-cron-monit-delayed_job-and-passenger-1021.html did.
check process delayed_job.0
with pidfile /u/apps/adgrok/shared/pids/delayed_job.0.pid
start program = "/usr/local/bin/rvm-shell -c 'RAILS_ENV=production /u/apps/adgrok/current/script/delayed_job start -i 0'" as uid deploy and gid deploy
stop program = "/usr/local/bin/rvm-shell -c 'RAILS_ENV=production /u/apps/adgrok/current/script/delayed_job stop -i 0'" as uid deploy and gid deploy
if 2 restarts within 15 cycles then timeout
还有一个值得注意的参考文献是与 RVM 作者关于 monit 的讨论:http://groups.google.com/group/rubyversionmanager/browse_thread/thread/d1a6c1f6396a8bf6/51afece4c8943912?#51afece4c8943912 http://groups.google.com/group/rubyversionmanager/browse_thread/thread/d1a6c1f6396a8bf6/51afece4c8943912?#51afece4c8943912
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)