문제

I want to run a script with Ruby 2.1.1 installed via Rbenv. 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. In the application directory I have the Gemfile.

Upstart give me the following error message: script main process (28879) terminated with status 127

도움이 되었습니까?

해결책

The solution is to specify the full path of bundle:

script
  cd /home/custom_user/application/ && /home/custom_user/.rbenv/shims/bundle exec ruby script.rb
end script
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top