whenever: Whenever tasks not running on Rails 4

Googled around a bunch and couldn’t find a good answer for this.

I set up whenever per the docs in my rails 4.1.6 app, and am having it run a simple task in schedule.rb:

set :output, "#{path}/log/cron.log"

every 15.minutes do
  runner "Order.sync_orders"
end

Order.rb:

#other crap

def self.sync_orders
    #do stuff
end

Running ‘whenever’ results in the output:

0,15,30,45 * * * * /bin/bash -l -c 'cd /Users/zach/Apps/myapp && bin/rails runner -e development '\''Order.sync_orders'\'' >> /Users/me/Apps/myapp/log/cron.log 2>&1'

## [message] Above is your schedule file converted to cron syntax; your crontab file was not updated.
## [message] Run `whenever --help' for more options.

The cron.log file is not written to, nor does the method actually get called. The output of crontab -l does indeed list the job there.

Thoughts?

About this issue

  • Original URL
  • State: open
  • Created 10 years ago
  • Comments: 19 (2 by maintainers)

Most upvoted comments

Ubuntu 16.04, rbenv, Capistrano, whenever, Rails 5

$ which rake
/home/deploy/.rbenv/shims/rake
schedule.rb

job_type :rbenv_rake, %Q{export PATH=/home/deploy/.rbenv/shims:/home/deploy/.rbenv/bin:/usr/bin:$PATH; eval "$(rbenv init -)"; \
                         cd :path && :environment_variable=:environment :bundle_command rake :task --silent :output }

job_type :rbenv_runner, %Q{export PATH=/home/deploy/.rbenv/shims:/home/deploy/.rbenv/bin:/usr/bin:$PATH; eval "$(rbenv init -)"; \
                         cd :path && :bundle_command :runner_command -e :environment ':task' :output }
#... and so on


# example of use
every 60.minutes do
  rbenv_rake "ts:index"
end

I followed what was here and it worked. in whenever --update-cron theNameOfCronJob I omitted theNameOfCronJob