Skip to content

CRON cannot access my database? Could not find table. #844

@jcsii98

Description

@jcsii98

I am trying to run a model method in my cron job with whenever.

schedule.rb : `env :PATH, ENV['PATH']

set :output, "./cron.log"

every 1.minute do
runner "Stock.fetch_and_update_stock_data"
end`

the model method runs perfectly fine in rails console however putting it through CRON with whenever returns the error:
cron.log : bundler: failed to load command: bin/rails (bin/rails) /home/jcsii98/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/activerecord-7.0.6/lib/active_record/connection_adapters/sqlite3_adapter.rb:387:in table_structure': Could not find table 'stocks' (ActiveRecord::StatementInvalid)`

Any suggestions?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions