Forum: Ruby on Rails Runner suddenly fails...

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
4d5e28840f8628550a22c410cb73ad60?d=identicon&s=25 Mattias Bud (mattias)
on 2009-01-21 17:13
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: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?
C64e63b70be7dfed8b0742540b8b27e5?d=identicon&s=25 Mark Reginald James (Guest)
on 2009-01-22 02:29
(Received via mailing list)
Mattias Bud wrote:
>   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 <command>

--
Rails Wheels - Find Plugins, List & Sell Plugins -
http://railswheels.com
4d5e28840f8628550a22c410cb73ad60?d=identicon&s=25 Mattias Bud (mattias)
on 2009-01-22 08:56
This is how the complete message looks like:

/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:in
`connect'
  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:in
`new'
  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:in
`send'
  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:in
`retrieve_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:in
`gem_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
4d5e28840f8628550a22c410cb73ad60?d=identicon&s=25 Mattias Bud (mattias)
on 2009-01-22 09:37
The database exists so it's not that.
C64e63b70be7dfed8b0742540b8b27e5?d=identicon&s=25 Mark Reginald James (Guest)
on 2009-01-23 11:44
(Received via mailing list)
Mattias Bud wrote:

> `real_connect': Unknown database 'dbname_production' (Mysql::Error)

Does this exist, or do you want to use the dbname_development database
by leaving the "-e production" option off the runner command?

--
Rails Wheels - Find Plugins, List & Sell Plugins -
http://railswheels.com
4d5e28840f8628550a22c410cb73ad60?d=identicon&s=25 Mattias Bud (mattias)
on 2009-01-23 12:15
After hours of testing and debugging I found that these masseges was
comming from the backup machine and not from the production one.

Problem solved
This topic is locked and can not be replied to.