whenever

Cron job in ruby on rails not work

坚强是说给别人听的谎言 提交于 2020-01-06 04:47:07
问题 I followed the railscast http://railscasts.com/episodes/164-cron-in-ruby but I cant seem to make it worked. I have schedule.rb in my config. I wished to refresh my Database.count everyday in my homepage. I cannot find the deploy.rb in my folder. Where is it? For testing purpose, I changed it to every 2 seconds. [schedule.rb] every '2 * * * *' do rake "pages_controller:home" end [pages_controller.rb] class PagesController < ApplicationController def home @title = "Home" @companies = Company

rails script using whenever gem error: __rvm_add_to_path: command not found

一曲冷凌霜 提交于 2020-01-05 07:59:21
问题 I'm using capistrano and the whenever gem. Capistrano deploys and updates the crontab on our ubuntu server with the cronjob detailed out in our schedule.rb file. But the cronjob doesn't happen. It fails and emails me every 5 minutes this error: /etc/profile.d/rvm.sh: line 67: __rvm_add_to_path: command not found /home/pkatepalli/.rbenv/versions/1.9.3-p448/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- bundler/setup (LoadError) from /home/pkatepalli/.rbenv

How to trigger a rake task using whenever in Rails

柔情痞子 提交于 2020-01-03 05:14:15
问题 I am writing a Rake task. I want to trigger it every last sunday of every month at 11 pm. How can I schedule this using the Whenever gem in Ruby on Rails? I have my rake task in the following location: app/lib/tasks/my_task.rake task :create_entries => :environment do puts "Hello" end 回答1: I don't think there's a rule for "last x day of the month" but you can always put an extra if test inside the block: every :sunday, :at => '11pm' do #if the month is different a week from now, we must be in

How to trigger a rake task using whenever in Rails

给你一囗甜甜゛ 提交于 2020-01-03 05:14:10
问题 I am writing a Rake task. I want to trigger it every last sunday of every month at 11 pm. How can I schedule this using the Whenever gem in Ruby on Rails? I have my rake task in the following location: app/lib/tasks/my_task.rake task :create_entries => :environment do puts "Hello" end 回答1: I don't think there's a rule for "last x day of the month" but you can always put an extra if test inside the block: every :sunday, :at => '11pm' do #if the month is different a week from now, we must be in

Ruby on Rails how to get started with whenever cron in Windows 10

为君一笑 提交于 2019-12-25 17:15:39
问题 I need to create a cronjob in windows using ruby on rails. I am using 'whenever' gem for that but not getting proper idea about that. Please let me know if there any alternative way for that. Thanks in advance. 回答1: The software utility cron is a time-based job scheduler in Unix-like computer operating systems. You can't use cron because you're using Windows . I suggest you try cygwin Cygwin is: a large collection of GNU and Open Source tools which provide functionality similar to a Linux

whenever + delayed_job with cron job in starting worker

烂漫一生 提交于 2019-12-25 08:16:22
问题 I am learning cron job and delayed job, and I want to send emails using background job; for that I'm using the delayed_job gem. I don't want to start the worker manually by running the rake jobs:work command, but I want to set this rake in cron job so whenever an user login into the dashboard this command is fired and a mail is sent to his address. Following is my code: Sending mail method def dashboard @user = User.find(params[:id]) UserMailer.delay.initial_email(@user) end UserMailer def

Whenever gem in rails error :'to_specs': Could not find bundler (>= 0) amongst

☆樱花仙子☆ 提交于 2019-12-25 06:32:04
问题 I am using whenever gem in my application. And i have scheduled a rake task every 5 minutes. But that rake task is not running every 5 minutes. When i saw the log it gave me error like `to_specs': Could not find bundler (>= 0) amongst [bigdecimal-1.1.0, io-console-0.3, json-1.5.4, minitest-2.5.1, rake-0.9.2.2, rdoc-3.9.4] (Gem::LoadError) this is the content in schedule.rb every 3.minutes do rake "mytask name" end 回答1: I had same issue solved by putting env :PATH, '/bin:/sbin:/usr/bin:/usr

How to specify rvm gemsets for Rails gem whenever?

你说的曾经没有我的故事 提交于 2019-12-25 04:53:28
问题 MyApp is using rvm gemset 1.9.3@rails-3.2. It is not default. I am using gem 'whenever' to periodically send email notifications. This is my schedule.rb: every 1.minutes do runner "MyModel.send_emails" # if ... end Cron job is not working unless gemset 1.9.3@rails-3.2 is default. How can i improve my schedule.rb in order to use another gemsets (not only default @global) for my scheduller. I have read official documentation: whenever and rvm issues and stackoverflow questions about "rvm

Not able to test cron job using whenever gem in rails 3

此生再无相见时 提交于 2019-12-25 02:51:34
问题 I did the following to implement cron jobs in rails 3 using a "runner" instead of a rake task. Step 1: I have whenever gem installed and scheduler.rb has following: set :environment, 'development' set :output, { :error => "/log/error.log", :standard => "/log/cron.log" } every 1.minute do runner "Cron.sendAutomaticsSMS()" end Step 2: Cron file: lib/cron.rb class Cron < ActiveRecord::Base def **sendAutomaticsSMS**() ----some code here --- end end Step 3: whenever --update-crontab --set

Not able to test cron job using whenever gem in rails 3

十年热恋 提交于 2019-12-25 02:51:31
问题 I did the following to implement cron jobs in rails 3 using a "runner" instead of a rake task. Step 1: I have whenever gem installed and scheduler.rb has following: set :environment, 'development' set :output, { :error => "/log/error.log", :standard => "/log/cron.log" } every 1.minute do runner "Cron.sendAutomaticsSMS()" end Step 2: Cron file: lib/cron.rb class Cron < ActiveRecord::Base def **sendAutomaticsSMS**() ----some code here --- end end Step 3: whenever --update-crontab --set