The cron rake task cannot find the database table

I created a cron job every time (https://github.com/javan/whenever):

every 1.hours do rake "scrape" end 

The rake scrape task runs fine when I run it manually, but when cron works, I get:

 rake aborted! Could not find table 'beskeds' 

Run command:

 /bin/bash -l -c 'cd /Users/klaus/Documents/src/Ruby/rails/fintra && RAILS_ENV=production bundle exec rake scrape --silent' 

I use RVM by the way

+4
source share
1 answer

OK, I get it now. It turns out that I only run this site on my own computer and do not have a production environment and, therefore, there is no production database ...

Whenever the configuration should be:

 every 1.hours do rake "scrape", environment => "development" end 

I also had to run each time using the environment:

 whenever -w --set environment=development 
+6
source

All Articles