[英]Use upstart to run a ruby script with rbenv install ruby
I want to run a script with Ruby 2.1.1 installed via Rbenv. 我想在通过Rbenv安装了Ruby 2.1.1的情况下运行脚本。 Here is my upstart script:
这是我的暴发户脚本:
start on runlevel [2345]
stop on runlevel [!2345]
setuid custom_user
setgid custom_user
script
cd /home/custom_user/application/ && rbenv shell 2.1.1 && bundle exec ruby script.rb
end script
If I run that command logged as the custom_user
it works perfectly. 如果我运行以
custom_user
身份登录的命令,它将运行完美。 In the application
directory I have the Gemfile
. 在
application
目录中,我有Gemfile
。
Upstart give me the following error message: script main process (28879) terminated with status 127
新贵给我以下错误消息:
script main process (28879) terminated with status 127
The solution is to specify the full path of bundle
: 解决方案是指定
bundle
的完整路径:
script
cd /home/custom_user/application/ && /home/custom_user/.rbenv/shims/bundle exec ruby script.rb
end script
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.