schedule.rb don't run with ruby 1.8.7 and rails 3.2.11

312 views
Skip to first unread message

sta...@gmail.com

unread,
Nov 4, 2013, 6:54:35 PM11/4/13
to whenev...@googlegroups.com
Hi, following the instructions from @lol007 http://stackoverflow.com/a/18864911/556548 i make the next example:
 
I haved a CRUD with info called Post with title:string, content:text and status:boolean with Ruby 1.8.7 and Rails 3.2.11 in development environment.
 
I'm add whenever gem to my gemfile and run the bundle install command. Then i run the command whenever . in the console.
 
This generate the config/schedule.rb when i add the next code:
 
# schedule.rb
every 5.minutes do
runner "Post.check_updated_at"
end
 
Then in my models/post.rb
 
# post.rb
def self.check_updated_at
where('updated_at > ?', 30.minutes.ago).update_all({ :status => :true })
end
 
I run the command rails s in the console. and wait 5 minutes to see if something happend but not, still the status like i created and updated.

Any can help me, thank you!

Javan Makhmali

unread,
Nov 4, 2013, 8:01:24 PM11/4/13
to whenev...@googlegroups.com
You’ll need to run `whenever --update-crontab` so Whenever installs a cron job for you. Then that job will run every 5 minutes (independently from your rails server).

This screencast is a bit dated, but it goes over the core concepts of whenever and cron. http://railscasts.com/episodes/164-cron-in-ruby Might be helpful.

-Javan


--
--
You received this message because you are subscribed to the Google
Groups "Whenever Gem" group and because you're awesome.
To post to this group, send email to whenev...@googlegroups.com
To unsubscribe from this group, send email to
whenever-gem...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/whenever-gem?hl=en
---
You received this message because you are subscribed to the Google Groups "Whenever Gem" group.
To unsubscribe from this group and stop receiving emails from it, send an email to whenever-gem...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

shrikant...@tudip.com

unread,
May 9, 2014, 4:02:51 AM5/9/14
to whenev...@googlegroups.com
Hi I did following steps
1.  wheneverize .

Here is schedule.rb files

every 1.minutes do
        runner "Autoupdate.test"
end  

autoupdate.rb model file

class Autoupdate < ActiveRecord::Base
   def self.test
      Rails.logger.info('----------Cron----------------')
   end
end
2.  whenever --update-crontab
Reply all
Reply to author
Forward
0 new messages