我想用通过 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
最佳答案
解决方法是指定bundle
的完整路径:
script
cd /home/custom_user/application/ && /home/custom_user/.rbenv/shims/bundle exec ruby script.rb
end script
关于ruby - 使用 upstart 通过 rbenv install ruby 运行 ruby 脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22439745/