使用upstart运行带有rbenv install ruby​​的ruby脚本

时间:2014-03-16 16:46:48

标签: ruby bundler rbenv upstart

我想通过Rbenv运行安装了Ruby 2.1.1的脚本。这是我的暴发脚本:

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

如果我运行该命令记录为custom_user它完美无缺。在application目录中,我有Gemfile

Upstart给我以下错误消息:script main process (28879) terminated with status 127

1 个答案:

答案 0 :(得分:4)

解决方案是指定bundle的完整路径:

script
  cd /home/custom_user/application/ && /home/custom_user/.rbenv/shims/bundle exec ruby script.rb
end script