whenever

Sending emails on user-selected dates

跟風遠走 提交于 2021-02-10 17:59:04
问题 My app involves people coming to a home page, entering a name of a bet they've made (for fun), their email address, a date they would like to be reminded, and some details about the bet. I am using the whenever gem to have this run once a day. bet.rb class Bet < ActiveRecord::Base attr_accessible :details, :email, :name, :reminder, :sent # Sends user a reminder if current_date is equal to the reminder date of the bet def check_bet current_date = Time.now.strftime("%Y-%m-%d").to_s @bets = Bet

Sending emails on user-selected dates

本秂侑毒 提交于 2021-02-10 17:54:11
问题 My app involves people coming to a home page, entering a name of a bet they've made (for fun), their email address, a date they would like to be reminded, and some details about the bet. I am using the whenever gem to have this run once a day. bet.rb class Bet < ActiveRecord::Base attr_accessible :details, :email, :name, :reminder, :sent # Sends user a reminder if current_date is equal to the reminder date of the bet def check_bet current_date = Time.now.strftime("%Y-%m-%d").to_s @bets = Bet

In Whenever gem, if we use every :month, does it mean the end of month or beginning?

ε祈祈猫儿з 提交于 2021-02-07 09:45:48
问题 When using the whenever gem we can set a monthly job like this : every :month do ... end Will this run the job at the end of the month or at the start of the month? I want to run it at the end. 回答1: From the tests in whenever repo: assert_equal '0 0 1 * *', parse_time(:month) So :month will generate a cron entry that looks like 0 0 1 * *.. This corresponds to run once a month at midnight of the first day of the month. One way to make the job run last day of the month would be to use the raw

In Whenever gem, if we use every :month, does it mean the end of month or beginning?

安稳与你 提交于 2021-02-07 09:43:21
问题 When using the whenever gem we can set a monthly job like this : every :month do ... end Will this run the job at the end of the month or at the start of the month? I want to run it at the end. 回答1: From the tests in whenever repo: assert_equal '0 0 1 * *', parse_time(:month) So :month will generate a cron entry that looks like 0 0 1 * *.. This corresponds to run once a month at midnight of the first day of the month. One way to make the job run last day of the month would be to use the raw

In Whenever gem, if we use every :month, does it mean the end of month or beginning?

自作多情 提交于 2021-02-07 09:43:06
问题 When using the whenever gem we can set a monthly job like this : every :month do ... end Will this run the job at the end of the month or at the start of the month? I want to run it at the end. 回答1: From the tests in whenever repo: assert_equal '0 0 1 * *', parse_time(:month) So :month will generate a cron entry that looks like 0 0 1 * *.. This corresponds to run once a month at midnight of the first day of the month. One way to make the job run last day of the month would be to use the raw

Rails making new cron jobs based on user input

橙三吉。 提交于 2020-06-28 05:06:30
问题 In my application, I want to invoke an action every two weeks based on when the user triggered an action. I guess what's confusing is why there doesn't seem to be a straight forward way of doing this. Ideally, the repeated job would be set in the model , not some other file . For example, the whenever gem has these instructions: Getting started $ cd /apps/my-great-project $ wheneverize . This will create initial config/schedule.rb file for you. But I don't want to put my schedules in there. I

Error running cron job `require': cannot load such file — bundler/setup (LoadError)

假装没事ソ 提交于 2020-02-24 05:27:32
问题 I have deployed application using Capistrano 3. I keep on getting following error. `require': cannot load such file -- bundler/setup (LoadError) Here is the cron tab list PATH=/home/deploy/magnificent/shared/bundle/ruby/2.2.0/bin:/usr/local/rvm/gems/ruby-2.2.2/bin:/usr/local/rvm/gems/ruby-2.2.2@global/bin:/usr/local/rvm/rubies/ruby-2.2.2/bin:/usr/local/rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games * * * * * /bin/bash -l -c 'cd /home/deploy

config file in schedule.rb with Rails Whenever gem?

允我心安 提交于 2020-02-02 11:17:27
问题 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

rails, whenever and docker - cron tasks doesn't run

为君一笑 提交于 2020-01-13 10:55:07
问题 My crontasks from schedule.rb doesn't work on docker container, but crontab -l result already contains this lines: # Begin Whenever generated tasks for: /app/config/schedule.rb 45 19 * * * /bin/bash -l -c 'bundle exec rake stats:cleanup' 45 19 * * * /bin/bash -l -c 'bundle exec rake stats:count' 0 5 * * * /bin/bash -l -c 'bundle exec rake stats:history' # End Whenever generated tasks for: /app/config/schedule.rb I can run this commands manually in container and it works. It seems like cron