0

In my Refinery Project, I am using cron job to update my one of the textfield.

Sample code : Code present in Model

def update_time
  @time = Page.all
  @time.each do |time|
    time.present_time = Time.now
    time.save
  end
end

Code : /config/schedule.rb

set :environment, 'development'

every 1.minutes do
  runner "Page.update_time"
end

Then run these command on the terminal :

$ whenever --update-crontab PageTest
[write] crontab file updated
$ crontab -l
# Begin Whenever generated tasks for: .../config/schedule.rb
* * * * * /bin/bash -l -c 'cd /home/trainee2/PageDevp && 
script/rails runner -e development '\''Page.update_time'\'''

$ sudo service cron restart

Then, rake job is not working. I am not able to make it running. Thanks in advance...

Rubyist
  • 6,486
  • 10
  • 51
  • 86
  • Does `Page.update_time` work from the console? The method declaration should be `def self.update_time` unless you're using the `class << self` syntax... maybe that's the problem – Arctodus Apr 05 '13 at 14:23
  • Yes, it works from the console. – Rubyist Apr 12 '13 at 03:49

0 Answers0