whenever

whenever gem schedule.rb file: doesn't recognize RAILS_ROOT variable

北城以北 提交于 2019-11-30 18:53:00
In schedule.rb file, the statement: require "#{RAILS_ROOT}/config/environment.rb" every "10 10 2 * * *" do command "mysqldump -u #{@db_username} -p#{@db_password} --single-transaction #{@db_name} > #{@backup_Path}/#{@db_name}.sql 2> log/error_crontab.log" end When i try to execute the whenever cmd from terminal, getting the following error: config/schedule.rb:48:in `initialize': uninitialized constant Whenever::JobList::RAILS_ROOT (NameError) from /usr/local/lib/ruby/gems/1.9.1/gems/whenever-0.7.0/lib/whenever/job_list.rb:19:in `instance_eval' from /usr/local/lib/ruby/gems/1.9.1/gems/whenever

Whenever cron job in Rails fails with 'production' database is not configured error

人走茶凉 提交于 2019-11-30 17:46:23
问题 In my Rails app I use whenever gem to run a Sideqik task. When I run that command manually in the rails console it works. But the Whenever cron fails with the following error : It keeps repeating in the log. How can I fix this? What is the problem? /home/pubudu/.rvm/gems/ruby-2.1.5/gems/activerecord-4.2.0/lib/active_record/connection_adapters/connection_specification.rb:248:in `resolve_symbol_connection': 'production' database is not configured. Available: ["development", "test"]

Whenever - Cron not working? Permission denied

自作多情 提交于 2019-11-30 04:57:55
问题 'I have set up a cron with wehenever, but its not working. I tried to run the command manually and i get the error /bin/bash: bin/rails: Permission denied . Here what the command of the cron looks like: /bin/bash -l -c 'cd /var/www/domain.net/main && bin/rails runner -e production '\''User.weekly_update'\''' I also tried to run this command as root but i got the same message. 回答1: Try to make bin/rails executable: chmod u+x bin/rails This is, of course, assuming that bin/rails is owned by the

How to make 'whenever' gem work on Windows?

我怕爱的太早我们不能终老 提交于 2019-11-28 14:13:37
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 (NoMethodError) Any idea how I can make whenever gem work? ruby 1.8.7 (2010-08-16 patchlevel 302) [i386

“Whenever” gem running cron jobs on Heroku

[亡魂溺海] 提交于 2019-11-28 04:52:55
I created an app that uses the whenever gem. The gem creates cron jobs. I got it working locally but can't seem to get it working on heroku cedar. What's the command to do this? running: heroku run whenever --update-crontab job1 doesn't work Short answer: use the scheduler add-on: http://addons.heroku.com/scheduler Long answer: When you do heroku run, we spin up a dyno put your code on it execute your command, wait for it to finish throw the dyno away Any changes you made to crontab would be immediately thrown away. Everything is ephemeral, you cannot edit files on heroku, just push new code.

“Whenever” gem running cron jobs on Heroku

丶灬走出姿态 提交于 2019-11-27 19:16:39
问题 I created an app that uses the whenever gem. The gem creates cron jobs. I got it working locally but can't seem to get it working on heroku cedar. What's the command to do this? running: heroku run whenever --update-crontab job1 doesn't work 回答1: Short answer: use the scheduler add-on: http://addons.heroku.com/scheduler Long answer: When you do heroku run, we spin up a dyno put your code on it execute your command, wait for it to finish throw the dyno away Any changes you made to crontab

Rails cron whenever, bundle: command not found

≡放荡痞女 提交于 2019-11-27 18:07:09
I am trying to use whenever to execute a rake task onces a day. Im getting this error /bin/bash: bundle: command not found /home/app/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find bundler (>= 0) amongst [minitest-1.6.0, rake-0.8.7, rdoc-2.5.8] (Gem::LoadError) from /home/app/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec' from /home/app/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems.rb:1210:in `gem' from /home/app/.rvm/gems/ruby-1.9.2-p180/bin/bundle:18:in `<main>' Here is

Rails, using whenever gem in development

穿精又带淫゛_ 提交于 2019-11-27 17:36:39
Sorry quick question here from a relative Rails newbie. I'm trying to use the Whenever gem to schedule a number of rake tasks. I can't for the life of me get it to actually begin running the cron jobs on my development machine. Judging from other stackoverflow threads, it appears I should add this: set :environment, "development" to my schedule.rb file. But then what? And then how do I stop the cron jobs once they've started? Using Rails 3.2.3 in OSX UPDATE: the answer is to run $ whenever -w which writes the cron job to a crontab file. The system then immediately starts running that crontab

Setting path for whenever in cron so it can find ruby

邮差的信 提交于 2019-11-27 12:22:41
问题 My ruby is in /usr/local/bin. whenever can't find it, and setting PATH at the top of my cron file doesn't work either, I think because whenever is running the command inside of a new bash instance. # this does not work PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/sbin # Begin Whenever generated tasks for: foo 0 * * * * /bin/bash -l -c 'cd /srv/foo/releases/20110429110637 && script/rails runner -e production '\''ActiveRecord::SessionStore::Session.destroy_recent(15)'\''' # End Whenever

Cron job not working in Whenever gem

旧时模样 提交于 2019-11-27 10:53:38
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(:target_date => Date.today) end end result of running the 'whenever command' 1 0 * * * /bin/bash -l -c 'cd