CARVIEW |
javan / whenever
- Source
- Commits
- Network (68)
- Issues (12)
- Downloads (12)
- Wiki (6)
- Graphs
-
Branch:
master
click here to add a description
click here to add a homepage
-
This article suggests we need to explicitly flush logs. Perhaps the snippet of code in the article could be generated by whenever?
https://earthcode.com/blog/2009/05/rails_script_runner_logging_cron.html
Comments
-
[feature request] start point for every X.minutes/hours
1 comment Created 9 months ago by traxanoswhen i use every 2.hours i get 0,2,4,6,8...
but i need 2 crons with differen tart time.cron 1 0,2,4,6,8...
cron 2 1,3,5,7,9...a range option were nice:
every 2.hours, :range => 1..23
Comments
-
Should be able to set 'nice' priority for jobs
0 comments Created 8 months ago by adamsalterHaven't got time to fork and fix this myself atm, but nice priority for jobs a definite 'nice-to-have' ;)
Comments
Please log in to comment. -
I would submit a patch to chronic, but it seems like mojombo isn't really updating chronic anymore. It looks like evaryont/chronic has been updated much more recently and doesn't have the dependency on hoe. Not sure if you want to change the chronic dependency or try to get mojombo to push a new version of chronic, but it would be nice to not have the extra dependency for whenever, especially when bundling it.
Comments
-
The option :output mentioned in the documentation doesn't work
1 comment Created 3 months ago by StefanH -
I use ruby stored in /opt/ruby-1.9.x-pXXX/ and I would like to set custom path to "ruby" (for script/runner) and "rake" commands in schedule.rb.
Comments
jeroenvandijk Wed Jan 20 04:46:26 -0800 2010 | linkI think have solved the rake issue you have : https://github.com/jeroenvandijk/whenever/tree/rake_path
I have done a pull request so hopefully it will be merge in the near future
Not sure how to go about the ruby version
Cheers, Jeroen
I found workaround. I'm setting custom environment PATH variable:
PATH=$PATH:/opt/ruby-1.9.1-p376/bin whenver --update-crontab
Whenever writes the custom PATH in crontab and everybody is happy :)
-
bug
I have a Rails app running in two environments to serve two countries.
The first whenever call setup most of the tasks (country independent), the second and third run the few that must be run for both countries (environments).
whenever --update-crontab myapp --set environment=staging_au && whenever --update-crontab myapp_au --set environment=staging_au --load-file config/schedule_both_countries.rb && whenever --update-crontab myapp_nz --set environment=staging_nz --load-file config/schedule_both_countries.rb
It will work the first time, but each time you update the cronjob after the file will get corrupted.
Seems like naming them au_myapp and nz_myapp is enough to solve it.whenever --update-crontab myapp --set environment=staging_au && whenever --update-crontab au_myapp --set environment=staging_au --load-file config/schedule_both_countries.rb && whenever --update-crontab nz_myapp --set environment=staging_nz --load-file config/schedule_both_countries.rb
Comments
-
It would be nice to add a new job_type called rails_script or smth.
0 comments Created 22 days ago by balepcNon of existing(rake, command, runner) fit well for that:
script/delayed_job start
I've it in my repo.
Comments
Please log in to comment. -
Whenever doesn't work outside of a Rails app
3 comments Created 14 days ago by joshuaclaytonAdding a config directory and running
wheneverize .
generates schedule.rb correctly, but then runningwhenever
raises anundefined method 'blank?' for nil:NilClass
error.Comments
xaviershay Thu Apr 22 17:56:17 -0700 2010 | linkI get this too - suspect because active_support isn't specified as a dep in the gem spec? Going to have a play around.
xaviershay Thu Apr 22 18:24:27 -0700 2010 | linkUsing bundler:
# Gemfile gem 'activesupport' gem 'whenever' # In a shell bundle install vendor bundle exec vendor/bin/whenever
Can you try the new version of Whenever (0.4.2) which requires active_support/all instead of just active_support. This fixed other issues with the new active support..
-
whenever and rvm (Ruby Version Manager) do not play nice together.
1 comment Created 13 days ago by i0nI've run into a rather bizarre problem while using whenever with rvm.
If I use and rvm ruby then whenever will refuse to run my cron jobs. It spits out a message saying that Rails 2.3.5 is not installed. Obviously this is wrong. If I remove rvm from my path and regenerate the job then it begins to work again. The only way that I have been able to have both working at the same time is to explicitly set path inside schedule.rb minus rvm.
env 'PATH', '/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/local/nginx/sbin:/usr/bin:/usr/sbin:'
every 2.minutes do
runner "MyClass.a_method" endwhenever will then work as it is executing the command from the system (default) ruby in /usr/bin and not any of my usual rvm rubies. Not good. It also introduces unwanted issues for deployment. Has anyone else run into this problem? I've tried all manner of configurations in schedule.rb to get whenever to behave but unless I remove rvm from my path (at least from whenever's perspective) then if I check mail I get an error like this:
Subject: Cron <i0n@Zico> /Users/i0n/Sites/commval/script/runner -e development "MyClass.a_method"
X-Cron-Env: <PATH=/Users/i0n/.rvm/rubies/ruby-1.9.1-p378/bin:/Users/i0n/.rvm/gems/ruby-1.9.1-p378/bin:/Users/i0n/.rvm/gems/ruby-1.9.1-p378@global/bin:/Users/i0n/.rvm/bin:/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/local/nginx/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin>
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <LOGNAME=i0n>
X-Cron-Env: <USER=i0n>
X-Cron-Env: <HOME=/Users/i0n>
Date: Wed, 21 Apr 2010 20:28:00 +0100 (BST)Missing the Rails 2.3.5 gem. Please
gem install -v=2.3.5 rails
, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.Comments
Also, I have just discovered that if I do something like this in schedule.rb to only edit path in development:
if Rails.env.development?
env 'PATH', '/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/local/nginx/sbin:/usr/bin:/usr/sbin:' endwhen I deploy to production or staging the if statement is totally ignored and the path is altered regardless. I'm at my wits end here, help!
-
Hello
I updated whenever from 0.4.1 to 0.4.2 and the whenever command line executable stopped working.
It cannot print anything, even "whenever -v" returned nothing.
My config/schedule.rb file looks like next
set :path, '/var/rails/app1/current' set :environment, :production set :output, {:standard => '/var/rails/app1/shared/log/cron.log', :error => '/var/rails/app1/shared/log/cron_error.log' } every 1.day, :at => '10:30pm' do rake "some:rake:task" end every 1.day, :at => '11:30pm' do rake "other:rake:task" end
I'm using Ruby Enterprise Edition 1.8.7 (2009-12-24 patchlevel 248) over Ubuntu 8.04.4 and my gems list is:
actionmailer (2.3.5, 2.3.2)
actionpack (2.3.5, 2.3.2)
activerecord (2.3.5, 2.3.2)
activeresource (2.3.5, 2.3.2)
activesupport (2.3.5, 2.3.2)
acts_as_tokenizable (0.3.1)
authlogic (2.1.3)
calendar_date_select (1.16.1)
chronic (0.2.3)
declarative_authorization (0.4.1)
dependent_select (0.7.2)
fastercsv (1.5.3)
fastthread (1.0.7)
graysky-translator (1.0.0)
hoe (2.6.0)
json_pure (1.4.2, 1.4.1)
open4 (1.0.1, 0.9.6)
paperclip (2.3.1.1)
passenger (2.2.11, 2.2.9)
postgres (0.7.9.2008.01.28)
rack (1.1.0, 1.0.1)
rails (2.3.5, 2.3.2)
rake (0.8.7)
rubyforge (2.0.4)
rubygems-update (1.3.6)
searchlogic (2.4.19)
vlad (2.0.0)
whenever (0.4.1)
will_paginate (2.3.12)Please don't hesitate to ask for more information about my environment configuration.
Comments
Your gem list says you have 0.4.1 installed, not 0.4.2. Maybe try uninstalling and reinstalling the gem.. What does running
which whenever
report back?Hello
I uninstalled the 0.4.2 version after seeing that it wasn't working.
If I run "which whenever" it shows me the same output with both versions:
/usr/local/bin/whenever
Please find below what I've just done in my terminal:
user@server:~$ which whenever /usr/local/bin/whenever user@server:~$ sudo gem update [sudo] password for user: Updating installed gems Updating whenever Successfully installed whenever-0.4.2 Gems updated: whenever Installing ri documentation for whenever-0.4.2... Installing RDoc documentation for whenever-0.4.2... user@server:~$ which whenever /usr/local/bin/whenever user@server:~$ cd /var/rails/app1/current user@server:/var/rails/app1/current$ whenever user@server:/var/rails/app1/current$ sudo gem uninstall whenever Select gem to uninstall: 1. whenever-0.4.1 2. whenever-0.4.2 3. All versions > 2 Successfully uninstalled whenever-0.4.2 user@server:/var/rails/app1/current$ whenever PATH=/opt/ruby-enterprise/bin/:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games 30 23 * * * cd /var/rails/app1/current && RAILS_ENV=production /usr/bin/env rake pictures:import:metafase >> /var/rails/app1/shared/log/cron.log 2> /var/rails/app1/shared/log/cron_error.log 30 22 * * * cd /var/rails/app1/current && RAILS_ENV=production /usr/bin/env rake pictures:import:vincle >> /var/rails/app1/shared/log/cron.log 2> /var/rails/app1/shared/log/cron_error.log user@server:/var/rails/app1/current$
Thanks for your help.
Still odd though that 0.4.2 is just giving you blank output. Any chance you've installed Whenever with both sudo and non-sudo permissions?
Hello javan
No, I have no gems installed without sudo.
I recently changed my version of ruby from the apt-get version to the Ruby Enterprise edition (maybe it's related).
-
Life on the bleeding edge! Whenever doesn't seem to like the shiny new Rails 3 beta at all.
If you add whenever to a Rails 3 apps Gemfile (through passenger) I get this error:
undefined method `load_tasks' for nil:NilClassI forked the whenever repo and had a bit of a look.
If I commented outbegin
load 'Rakefile' rescue LoadError
nil endfrom lib/whenever.rb then the gem will load in Rails 3. I'm not 100% what this bit of code is trying to do though, it mentions trying to load the Rails projects Rake tasks? It's trying to list available rake tasks for inclusion in cron jobs?
Anyway, after that I had to change one of the require paths to be able to run the test suite, returned 14 or so errors mainly around Chronic::RepeaterTime::Tick
Happy to help with upgrading to work with Rails 3, would be cool to get a little insider info on how things are set up!
Comments
Loading the Rakefile is my somewhat clunky way of loading the Rails environment for the app. I originally thought I might hook in to the rake tasks, but didn't need to in the end. I really don't need the whole environment loaded either - all I use it for is determining the RAILS_ROOT. I'm sure there's a better way. Does Rails 3 have a Rakefile?
Hi Javan.
Yep Rails 3 has a Rakefile, but it looks a little different. This is the contents of a standard Rails 3 Rakefile:
require File.expand_path('../config/application', FILE)
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'Rails::Application.load_tasks
So I'm guessing that the require File..... line is the problem as it has changed from before?
If all you need is the root path of the rails app (if it exists!) could you not do something like:
begin
rails_path = Rails.root.to_s
rescue NameError
nil
end
Which would assign a local variable the path of the Rails app (if it exists). You could then call this whenever you need it. As far as I can tell this will work across Rails versions, but if for some reason you needed to test for the version you could just use conditionals with Rails.version. It's quite late here so hopefully this makes sense and I haven't said or done anything stupid!
I had no idea about this. Thanks for pointing it out. I'll get it in there.