whenever

Cron + whenever not working with RVM

女生的网名这么多〃 提交于 2019-12-06 09:17:08
问题 I am using RVM environment. RUby version : 2.1.2 rails : 4.1.1 schedule.rb : every 1.minute do runner "note.send_mail" end I used whenever --update-crontab to update the cron tab. when I check the jobs using crontab -l it shows up as below with no proper time set up. and the cron job does not work. * * * * * /bin/bash -l -c 'cd /Desktop/folder1/blog2 && bin/rails runner -e production '\''note.send_mail'\''' Can some one help me out fix this. Thanks! 回答1: Go to your ~/.rvmrc file and add the

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

戏子无情 提交于 2019-12-06 07:19:56
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 => '/home/admin/shared/log/cron.log', :error => '/home/admin/shared/log/cron-error.log'} job_type :rake, "cd

config file in schedule.rb with Rails Whenever gem?

别等时光非礼了梦想. 提交于 2019-12-06 06:25:21
I have a file called config.yml in my /config folder of my rails application. I also have an initializer: config/initializers/load_config.rb with the following code: APP_CONFIG = YAML.load_file("#{RAILS_ROOT}/config/config.yml") I am using the Whenever gem to set up a cron job, and would like to use my APP_CONFIG to call a function like so: #inside schedule.rb every 2.hours do runner "MyModel.someMethod('#{APP_CONFIG['some_value']}')" end but the Whenever gem doesn't seem to recognize the config file when I call whenever --update-crontab mysite How can I incorporate values from my

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

混江龙づ霸主 提交于 2019-12-06 03:51:13
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_servers(). Is it possible to do this? Or would I have to move whatever is inside my application_controller

Whenever Gem Fails to Run “bundle exec” Correctly in Capistrano

ⅰ亾dé卋堺 提交于 2019-12-06 03:40:39
I'm having problems deploying the Whenever gem to my production environment using Capistrano. The problem is stemming from a bundle exec whenever command that's triggering some 'missing gem' issues (yet running bundle install from the shell shows that everything is in fact there!). My feeling is that one of two things is happening: that Bundler isn't fully loading before bundle exec is being called, or that somehow there's a path issue that's running it in the wrong place. Here's what's going on: * executing `deploy' * executing `deploy:update' ** transaction: start * executing `deploy:update

Whenever gem on aws opsworks

谁都会走 提交于 2019-12-05 02:31:50
问题 Does anyone have experience/success using the whenever gem on aws opsworks? Is there a good recipe? Can I put that recipe on a separate layer and associate one instance with that additional layer? Or is there a better way to do it? Thanks!!! EDIT: We ended up doing it a bit differently... Code: Can’t really post the real code, but it’s like this: in deploy/before_migrate.rb: [:schedule].each do |config_name| Chef::Log.info("Processing config for #{config_name}") begin template "#{release_path

Sending mails automatically through action mailer Rails 3.1

女生的网名这么多〃 提交于 2019-12-04 19:37:53
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.rb every 1.minute do runner "User.weekly_update", :environment => 'development' end in users_mailer.rb

Cron + whenever not working with RVM

浪子不回头ぞ 提交于 2019-12-04 15:54:43
I am using RVM environment. RUby version : 2.1.2 rails : 4.1.1 schedule.rb : every 1.minute do runner "note.send_mail" end I used whenever --update-crontab to update the cron tab. when I check the jobs using crontab -l it shows up as below with no proper time set up. and the cron job does not work. * * * * * /bin/bash -l -c 'cd /Desktop/folder1/blog2 && bin/rails runner -e production '\''note.send_mail'\''' Can some one help me out fix this. Thanks! Go to your ~/.rvmrc file and add the following: rvm_trust_rvmrcs_flag=1 Then whenever --update-crontab again. According to the README of whenever

Cron not working in Whenever gem

两盒软妹~` 提交于 2019-12-04 12:23:30
I'm trying to use a gem whenever on my rails application, it seems like its not working because I created a task in my model and defined a method that just prints out the time. whenever I try to run whenever -i it gives me the following error /usr/local/lib/ruby/gems/1.8/gems/whenever-0.6.2/lib/whenever/job_list.rb:21:in `initialize': undefined method `>' for :environment:Symbol (NoMethodError) I don't know if I might be doing something wrong when I setup the gem. I am testing it on development environment My code is as follows schedule.rb every 1.minutes do runner "Sale.unverified

How to detect Rails environment inside whenever

人走茶凉 提交于 2019-12-04 08:19:09
问题 This question will probably only make sense if you know about the whenever gem for creating cron jobs. For my app, I want to use whenever in all the environments, including testing and development . My schedule.rb looks like this: set :output, { :error => "#{path}/log/error.log", :standard => "#{path}/log/cron.log" } set :environment, Rails.env.to_sym every 5.minutes do rake 'db:activity:synchronize' end but it fails on Rails.env.to_sym ( and the same stands for RAILS_ENV ): /home/marius/.rvm