whenever

Connection refuse when sending mail with cron tab

老子叫甜甜 提交于 2019-12-11 20:16:14
问题 I'm doing a daily sending email task by using whenever gem. I created a rake task in RAKEFILE name coffee. Here is my task's code: task :coffee => :environment do ReservationBooksNotify.notify.deliver puts "hihi" end When I run this task in console rake coffee , it worked! But when I create a schedule in schedule.rb to automatically sending mail every minute, I get an error hihi rake aborted! Connection refused - connect(2) The error when I trace rake coffee RAILS_ENV=production --trace **

Ruby/Rails - Whenever gem - Loop cron tasks

一世执手 提交于 2019-12-11 18:09:11
问题 I would like to control my cron jobs through my administration page. Basically I have my cronjobs in my database, and I would like to create my crontab "on the fly". Here's an example: require "#{RAILS_ROOT}/config/environment.rb" Cron.all.each do |cron| if cron.at.blank? every eval(cron.run_interval) do cron.cmd end else every eval(cron.run_interval), :at => cron.time do cron.cmd end end end every 1.day do command "whenever --update-crontab" end But Whenever doesn't output any of the tasks

Setting env variable to a cron scheduled task using whenever gem

雨燕双飞 提交于 2019-12-11 12:41:41
问题 In my code below, I wanted to set few environment variables stored in a file. Am I missing something? Printing env in production after 'bundle exec whenever' does not show the environment variables set. Using whenever gem for a scheduled cron task and spent hours figuring this. Any other way can be suggested too. every 1.day, :at => '2:30 am' do # Run shell script to assign variables and continue the rake task system "for line in `cat config/myEnvFile.env` ; do export $line ; done" rake "task

Could not find rake using whenever rails

心已入冬 提交于 2019-12-11 02:40:29
问题 Hello I have a strange problem, I'm trying to get rake task working in whenever, but have this problem Could not find rake-10.4.2 in any of the sources (Bundler::GemNotFound) . It's strange, because it searches this rake version in ruby 2.1.2 version /home/vyivrain/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.2/lib/bundler/spec_set.rb:92 . However I'm using ruby 2.2.0 in rvm and the gem list is also using that version. It's a simple cron job: every 1.minute do rake 'process

Unable to run cronjob using whenever in rails 3

谁说我不能喝 提交于 2019-12-10 05:00:33
问题 i follow all the steps for whenever with reference to https://github.com/javan/whenever in schedule.rb require 'yaml' set :environment, 'production' set :output, { :error => "/log/error.log", :standard => "/log/cron.log" } every 1.minute do runner "User.weekly_update" end in gemfile gem 'whenever', :require => false output of some command localhost:~/project$ whenever -i [write] crontab file updated localhost:~/project$ crontab -l # Begin Whenever generated tasks for: /home/bacancy/project

Whenever ruby scheduler doesn't work, what am I missing?

百般思念 提交于 2019-12-08 06:08:58
问题 Cannot make it works ... In my config/schedule.rb I have : set :output, '../log/development.log' every 5.minutes do runner "UserWatchedRepo.update" end Note the log setted, but nothing happen. In my Rails 3.0.10 model file app/models/user_watched_repo.rb I get : class UserWatchedRepo include Mongoid::Document def update conn = FaradayStack.build 'https://api.github.com' User.all.map do |user| nickname = user.nickname resp = conn.get "/users/#{nickname}/watched" resp.body.each do |repo| user

Missing required gems when execute cron created by whenever gem in production environment

末鹿安然 提交于 2019-12-08 00:46:49
问题 I've ruby on rails application running in production, this apps have STOCK model and it should be updated every 1 minute. For updating this model i create simple rake task db:populate:stocks , when it contain only two operation : truncate the STOCK model fill STOCK model with latest data fetch from webservice this rake task should be execute every 1 minute, for this purpose i use whenever gem . Here my schedule.rb : env :PATH, ENV['PATH'] set :job_template, nil set :output, {:standard => '

Rails Whenever Gem How to Run Specific Method in Controller.rb File

泄露秘密 提交于 2019-12-07 14:43:59
问题 I am looking to run a specific method inside my controller.rb file every minute. I am looking at using the whenever gem for rails but I am a bit confused on how to do this. Currently in schedule.rb I have: every 1.minutes do runner "Server.update_all_servers" end I am unsure exactly what the runner command does. Could someone explain what this command exactly does? From my understanding it calls a Model.ModelMethod but I need to call a method in application_controller.rb called update_all

whenever PATH in crontab file for rails 3 ubuntu

半腔热情 提交于 2019-12-07 14:10:24
问题 I am using whenever gem with rails 3. On my production server (ubuntu) , the runner task does not run. I tried setting the :set job_template to get -l -i as mentioned in this github ticket. However that does not solve the problem. The problem on this particular production ubuntu is that the ruby path is not there in echo $PATH : echo $PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games Whereas the ruby path is /var/rails/myapp/shared/bundle/ruby/1.8/bin So if I

Sending mails automatically through action mailer Rails 3.1

纵饮孤独 提交于 2019-12-06 13:06:09
问题 I have to send weekly emails to all the user about the latest things happening. I am using ActionMailer to accomplish other mailing task however I have no clue how to automate the weekly emails. Update I found whenever gem which could be used to schedule cron jobs. I guess this could be used to send weekly emails which I intend to. Still looking how to make it work with ActionMailer will update once I find the solution Update 2 This is what I have done so far using whenever gem:- in schedule