0

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?

rastko
  • 567
  • 9
  • 24

1 Answers1

2

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.

Sam
  • 3,047
  • 16
  • 13
  • I ran the command that you said and it was executed with no errors... But in the response message I got this in the text: && RAILS_ENV=production does this mean that it going to be executed only in production enviroment? – rastko Mar 14 '13 at 22:07
  • Try `whenever --update-crontab appname --set environment=development` – Sam Mar 15 '13 at 11:54