I want to automatically run a script when my Amazon server deploys. However, I keep getting the following error in my logs:
/root/start.sh: /usr/bin/bundle: /usr/bin/ruby: bad interpreter: No such file or directory
I’ve tried massaging my start script, but haven’t found a solution yet. I can load the god file manually, but when I start my machine, I get the following error. How do I set it up so that my bundler/ruby is detected when my script runs?
which ruby => /usr/local/rvm/rubies/ruby-1.9.3-p194/bin/ruby
This is my script that is supposed to autorun (start.sh)
cat /dev/null > /root/log
echo "Starting environment for $(whoami) at $(date)" >> /root/log
export RAILS_ENV=production
export RAILS_ROOT=/root/Rails3/www_rails
export QUEUE_NAME=place_matching
export HOME=/root
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function
cd /root/Rails3/www_rails
RAILS_ENV=production bundle exec god -c /root/Rails3/www_rails/god/resque_generic.god >> /root/log 2>&1
echo "Environment running at $(date)" >> /root/log
RVM provides documentation for your problem https://rvm.io/integration/god/
Additionally you could try this script:
this is new notation of rvm which basically can be wrote down as:
and is equivalent to what you were trying to do.
One more important thing, if you are running this as a different user thant the one owning RVM then your project
.rvmrcrequires to be trusted for that new user also. Alternatively you could use one of the new project files that do not require trusting:.ruby-version=>1.9.3@projectGemfile=>#ruby=1.9.3@project/ruby="1.9.3".versions.conf=>ruby=1.9.3@projectNote that the second form also does bundler validation and does not allow patchlevel nor gemset name.