rastko
rastko

Reputation: 655

Invoking rake with whenever

I just started using Rails Whenever plugin. I have rake file cron. with task:

task :cron => :environment do
   puts "Task invoked!"
end

And in schedule.rb I have this:

every 2.minutes do 
   rake "cron", enviroment => "development"
end

Once I start my app and specified interval passes, nothing happens? I am pretty new to Ruby and Rails so what am I doing wrong?

Upvotes: 0

Views: 64

Answers (1)

Sam
Sam

Reputation: 3067

You'll need to write the schedule to your crontab. Run this command in your app:

bundle exec whenever --update-crontab myapp

When you run this command, whenever takes the Ruby syntax, translates it to cron syntax and adds it to your crontab.

Upvotes: 2

Related Questions