1

I am trying to run a rake task from script using crontab @reboot

The crontab looks like this:

@reboot cd /home/me/apps/packaged/X/ && ./resque_startup.sh > /home/me/sss.txt 2>&1

the resque_startup script (Yes the code can be more idiomatic but thats not the case) :

if [ -z ${1+x} ]; then
  RAILS_ENV=xxx /usr/local/bin/rake deploy:resque
else
 if [ $1 = 'start' ]; then
  RAILS_ENV=xxx rake deploy:resque
elif [ $1 = 'stop' ]; then
  echo "stop resque"
else
  echo "Invalid command, use start|stop"
fi
fi

I get the following error:

rake aborted!
Bundler::GemNotFound: Could not find nokogiri-1.5.5 in any of the sources
/var/lib/gems/1.9.1/gems/bundler-1.10.6/lib/bundler/spec_set.rb:92:in `block in materialize'
/var/lib/gems/1.9.1/gems/bundler-1.10.6/lib/bundler/spec_set.rb:85:in `map!'
/var/lib/gems/1.9.1/gems/bundler-1.10.6/lib/bundler/spec_set.rb:85:in `materialize'
/var/lib/gems/1.9.1/gems/bundler-1.10.6/lib/bundler/definition.rb:140:in `specs'
/var/lib/gems/1.9.1/gems/bundler-1.10.6/lib/bundler/definition.rb:185:in `specs_for'
/var/lib/gems/1.9.1/gems/bundler-1.10.6/lib/bundler/definition.rb:174:in `requested_specs'
/var/lib/gems/1.9.1/gems/bundler-1.10.6/lib/bundler/environment.rb:18:in `requested_specs'
/var/lib/gems/1.9.1/gems/bundler-1.10.6/lib/bundler/runtime.rb:13:in `setup'
/var/lib/gems/1.9.1/gems/bundler-1.10.6/lib/bundler.rb:127:in `setup'
/var/lib/gems/1.9.1/gems/bundler-1.10.6/lib/bundler/setup.rb:18:in `<top (required)>'
/home/me/apps/packaged/X/config/boot.rb:6:in `<top (required)>'
/home/me/apps/packaged/X/config/application.rb:1:in `<top (required)>'
/home/me/apps/packaged/X/Rakefile:5:in `<top (required)>'
(See full trace by running task with --trace)

note that if i run the script manualy from X folder everything works fine

Thanks.

Gleeb
  • 10,773
  • 26
  • 92
  • 135
  • Install Xcode command line tools: http://stackoverflow.com/questions/11568120/error-when-installing-nokogiri-on-mac-withsudo-gem-install-nokogiri – aguynamedloren Oct 28 '15 at 08:41

1 Answers1

0

Try using:

bundle install --path vendor/cache
Wes Foster
  • 8,770
  • 5
  • 42
  • 62
Artyom Kalmykov
  • 390
  • 1
  • 9