Set up my whenever schedule.rb as:
env :PATH, ENV['PATH']
set :output, "./cron.log"
every 1.minute do
runner "Stock.fetch_and_update_stock_data"
end
and in cron.log:
bundler: failed to load command: bin/rails (bin/rails)
Could not find table 'stocks' (ActiveRecord::StatementInvalid)
I am running this in WSL and have only followed official installation steps.
running whenever command:
* * * * * /bin/bash -l -c 'cd /home/jcsii98/avion/stocktrading_api
&& bundle exec bin/rails runner -e production
'\''Stock.fetch_and_update_stock_data'\'' >> ./cron.log 2>&1'
I have tried running a simple puts method in my model like Stock.whenever_sample and it was successful in returning the puts statement so I think the problem is really just cron not finding the Stocks table. I have also tried running the model method in rails console manually and it behaved as expected.