rvm monit delay_job [英] rvm monit delayed_job

查看:131
本文介绍了rvm monit delay_job的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用monit运行delay_job,但是该命令无法作为rvm的路径(每个用户安装本地rvm)运行。我的应用程序是带有捆绑器的rails2应用程序。 Monit无法找到捆绑程序。有人对我如何告诉RVM路径有任何建议吗?

I am trying to run delayed_job using monit, but its failing to run as rvm's paths (local rvm installation per user basis) are not available to the command. My application is a rails2 app with bundler. Monit is not able to find bundler. Does anyone have any suggestions as to how i can tell about the rvm paths to monit?

我遇到了错误

[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

My config/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"

和脚本/ delayedjob可执行文件

and script/delayed_job executable

#!/usr/bin/env ruby

require File.expand_path(File.join(File.dirname(__FILE__), '..', 'config', 'environment'))
require 'delayed/command'
Delayed::Command.new(ARGV).daemonize


推荐答案

如果您已经正常工作与其他服务一起监视,只需为rvm环境添加delay_job守护程序,您可以尝试使用此conf文件(对我有用)

If you already have properly working monit with other services and just need to add delayed_job daemon for rvm environment you can try to use this conf file (it works for me)

/ etc / monit /conf.d/delayed_job.conf (我有ubuntu服务器)

/etc/monit/conf.d/delayed_job.conf (i have ubuntu server)

check process delayed_job with pidfile /{project_folder}/tmp/pids/delayed_job.pid
start program = "RAILS_ENV=production rvm -S /{project_folder}/script/delayed_job start"
stop program = "RAILS_ENV=production rvm -S /{project_folder}/script/delayed_job stop"






此处 rvm -S 命令让脚本在当前rvm ruby​​环境下运行


Here rvm -S command let script run under current rvm ruby environment

您可以尝试使用

$ RAILS_ENV=production rvm -S /{project_folder}/script/delayed_job start

命令,如果守护程序将启动(将最后一个单词更改为'status'进行检查),那么您使用delay_job.conf文件的机会就更大了

command and if daemon will start (check it with changing last word to 'status') than you have good chances with delayed_job.conf file

然后不要忘记检查pid文件是否也在 tmp / pids / 文件夹中创建了

And do not forget to check if pid file had created in tmp/pids/ folder too

这篇关于rvm monit delay_job的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆