Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Whenever gem won't update crontab tasks

I have been using the whenever gem on my 2+ year old slice at Slicehost. I can't however do the same on my new slice.

Main differences is that I'm now running RVM on both my MBP and the slice. I am also running Rails 3. I've got Rubygems v 1.5.0 and latest versions of RVM , Ruby 1.9.2p136, Capistrano and about every other package out there.

I have tried a million things, read all the docs and as of now I'm using the whenever gem version 0.6.2. I have also looked at all questions on related topics on SO as well as Google.

Here is the code in deploy.rb:

namespace :deploy do
  ...
  desc "Update the crontab file"
  task :update_crontab, :roles => :db do
    run "cd #{release_path} && whenever --update-crontab #{application}"
  end   
end

after 'deploy:update_code', 'deploy:update_crontab'

Here is the error message I get after running 'cap deploy'

failed: "rvm_path=$HOME/.rvm/ $HOME/.rvm/bin/rvm-shell '1.9.2' -c 'cd /home/deploy/public_html/lasource/releases/20110209201551 && /home/deploy/.rvm/gems/ruby-1.9.2-p136/bin/whenever --write-crontab'" on lasource.ohlalaweb.com

Any suggestions will be welcome.

By the way, where are the capistrano logs?

Having added 'bundle exec' thanks to the Simone's suggestion, I managed to complete the cap deploy routine as it everything went well. The new problem however is that my crontab file is still empty of tasks and did not create my section with its 4 tasks.

like image 934
allesklar Avatar asked Dec 28 '22 01:12

allesklar


1 Answers

If using Rails 3, remember to execute the command with bundle exec.

namespace :deploy do
  desc "Update the crontab file"
  task :update_crontab, :roles => :app, :except => { :no_release => true } do
    run "cd #{release_path} && bundle exec whenever --update-crontab #{application}"
  end
end
like image 199
Simone Carletti Avatar answered Jan 11 '23 17:01

Simone Carletti