Question

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

Was it helpful?

Solution

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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top