I have some jobs running through cron jobs and runner that suddenly
starts failing.
This is how it looks:
from
/usr/local/lib/ruby/gems/1.8/gems/rails-2.1.2/lib/commands/runner.rb:47
from
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in gem_original_require' from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:inrequire’
from /usr/local/www/letter_archive/crontabs/…/script/runner:3
This only happens if the job gets triggered by cron not if I do it by
hand.
I suspect this started hapening when I upgraded to gem 1.3.1
from
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`require’
from /usr/local/www/letter_archive/crontabs/…/script/runner:3
This only happens if the job gets triggered by cron not if I do it by
hand.
I suspect this started hapening when I upgraded to gem 1.3.1
Any ideas?
I’d have to see more of the stack trace to be sure, but it’s
probably due to problems with either the PATH or GEM_HOME
environment variables in the cron shell context.
Try a crontab command like
env PATH=/usr/local/bin:/usr/bin GEM_HOME=/usr/local/lib/ruby/gems/1.8
/usr/local/www/letter_archive/script/runner -e production
/usr/local/lib/ruby/gems/1.8/gems/rails-2.1.2/lib/commands/runner.rb:47:
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active_record/connection_adapters/mysql_adapter.rb:527:in real_connect': Unknown database 'dbname_production' (Mysql::Error) from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active_record/connection_adapters/mysql_adapter.rb:527:inconnect’
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active_record/connection_adapters/mysql_adapter.rb:186:in initialize' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active_record/connection_adapters/mysql_adapter.rb:85:innew’
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active_record/connection_adapters/mysql_adapter.rb:85:in mysql_connection' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:292:insend’
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:292:in connection=' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:260:inretrieve_connection’
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:78:in connection' ... 6 levels... from /usr/local/lib/ruby/gems/1.8/gems/rails-2.1.2/lib/commands/runner.rb:47 from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:ingem_original_require’
from
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`require’
from /usr/local/www/letter_archive/crontabs/…/script/runner:3