whenever

How to make 'whenever' gem work on Windows?

孤街醉人 提交于 2019-11-27 08:32:47
问题 I wan to run "simple" cron using whenever on Windows XP. So I installed whenever gem install whenever and then ran my cron.rb require 'rubygems' require 'whenever' every 1.days, :at => '5:30am' do command "puts now" end but it complained that You don't have i18n installed in your application. Please add it to your Gemfile and run bundle install So I ran gem install i18n and now the same code gives me an error C:\whenever>ruby cron.rb cron.rb:4: undefined method 'every' for main:Object

Rails - Whenever gem - Dynamic values

ε祈祈猫儿з 提交于 2019-11-26 20:44:08
问题 Lets say I have a cronjob like this: every 1.day, :at => '4:30 am' do runner "MyModel.task_to_run_at_four_thirty_in_the_morning" end Although, I would like to make '1.day' more dynamic, such as changing the value via a form in an administration page. Then it could look like this: every Constant.find(2).value, :at => '4:30 am' do or @const = Constant.find(2) every @const.span, :at => @const.time do Can anyone come up with an idea on how to make this work? Obviously, the reason for this would

Cron job not working in Whenever gem

你离开我真会死。 提交于 2019-11-26 19:02:55
问题 I have an application that contains a bunch of tasks, and every day I want to run a cron job that creates a DayTask for each Task in the database. A Task has_many DayTasks and these daytasks are what users will be checking off every day. I'm using the whenever gem but it doesn't seem to be running at all. Any ideas? config/schedule.rb every 1.day, :at => "12:01am" do runner "Task.generate_tasks_for_day" end Task.rb def generate_tasks_for_day Task.all.each do |task| task.day_tasks.create(