whitesiroi
whitesiroi

Reputation: 2843

"[fail] Can't find file: config/schedule.rb" rails, whenever gem

I got this message -> "[fail] Can't find file: config/schedule.rb"

I'm using "whenever" gem -> https://github.com/javan/whenever

I did put it in my Gemfile

gem 'whenever', :require => false

then wheneverize .

& I have file in config/schedule.rb with

every 2.hours do
  rake "thinking_sphinx:index"
end

When I run -> "whenever" or "whenever --update-crontab mycron --set environment=development" or "whenever --update-crontab mycron" I get this msg -> "[fail] Can't find file: config/schedule.rb"

Thank you.

Upvotes: 3

Views: 2002

Answers (2)

jvnill
jvnill

Reputation: 29599

The issue is you're probably not in the rails root directory so going to the root path should fix your issue.

Upvotes: 4

rorra
rorra

Reputation: 9693

Can you try with?

cd /my_rails_application_root_path && bundle exec whenever

You can check the binary source code at https://github.com/cwninja/whenever/blob/master/bin/whenever

If you don't pass the attribute -f, it will use config/schedule.rb by default, but you can also run

whenever -f COMPLETE_PATH_TO_SCHEDULE_RB

Upvotes: 2

Related Questions