Script/runner + cron job = sad rmagick

Hi,

I’m running a cron job to parse some RSS feeds. When running the
following
from the terminal everything works as expected:

antrover:~/Sway/Projects/mi7/trunk/mi7 dave$ script/runner -e
development "
GetRssData.find_and_parse"
Loaded suite script/runner
Started
Finished in 0.001333 seconds.
0 tests, 0 assertions, 0 failures, 0 errors

However, when setting up the cron job:

*/20 * * * * ~/Sway/Projects/mi7/trunk/mi7/script/runner -e development
"
GetRssData.find_and_parse"

I get the following RMagick error:

/Users/dave/Sway/Projects/mi7/trunk/mi7/script/…/config/…/vendor/rails/railties/lib/commands/runner.rb:27:
/Users/dave/Sway/Projects/mi7/trunk/mi7/script/…/config/…/vendor/rails/activerecord/lib/…/…/activesupport/lib/active_support/dependencies.rb:147:in
require': No such file to load -- RMagick (MissingSourceFile) from /Users/dave/Sway/Projects/mi7/trunk/mi7/script/../config/../vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:147:inrequire’
from
/Users/dave/Sway/Projects/mi7/trunk/mi7/script/…/config/…/vendor/plugins/file_column/lib/validations.rb:95:in
validates_image_size' from /Users/dave/Sway/Projects/mi7/trunk/mi7/script/../config/../app/models/member.rb:125 from /Users/dave/Sway/Projects/mi7/trunk/mi7/script/../config/../vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:140:inload’
from
/Users/dave/Sway/Projects/mi7/trunk/mi7/script/…/config/…/vendor/rails/activerecord/lib/…/…/activesupport/lib/active_support/dependencies.rb:140:in
load' from /Users/dave/Sway/Projects/mi7/trunk/mi7/script/../config/../vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:56:inrails_pre_engines_require_or_load’
from
/Users/dave/Sway/Projects/mi7/trunk/mi7/script/…/config/…/vendor/plugins/engines/lib/engines/dependencies_extensions.rb:60:in
rails_1_1_require_or_load' from /Users/dave/Sway/Projects/mi7/trunk/mi7/script/../config/../vendor/plugins/engines/lib/engines/dependencies_extensions.rb:14:inrequire_or_load’
… 11 levels…
from /Users/dave/Sway/Projects/mi7/trunk/mi7/script/runner:3:in
eval' from /Users/dave/Sway/Projects/mi7/trunk/mi7/script/../config/../vendor/rails/railties/lib/commands/runner.rb:27 from /Users/dave/Sway/Projects/mi7/trunk/mi7/script/runner:3:inrequire’
from /Users/dave/Sway/Projects/mi7/trunk/mi7/script/runner:3

Why is it saying “No such file to load – RMagick (MissingSourceFile)”?

Is there a way to ignore validations? My Member model does use rmagick
when
uploading files.

I have frozen the project at 1.1.6

This is what get_rss_data.rb looks like:

class GetRssData
def self.find_and_parse
feeds_to_parse = MemberRssUrl.find(:all)
for feed in feeds_to_parse
member = Member.find(feed.member_id)
ExternalFeedTools.new(feed.rss_url, member).parse_feed
end
end
end

ExternalFeedTools just parses the items out of the actual feed using
‘FeedTools’. Nothing exciting going on there.

I’ve been using rmagick on my Powerbook for awhile (1.5 + years) and
this is
the first problem I’ve ever encountered.

Any ideas?

Thanks!
-Dave

Dave H. wrote:

Hi,

I’m running a cron job to parse some RSS feeds. When running the
following
from the terminal everything works as expected:

antrover:~/Sway/Projects/mi7/trunk/mi7 dave$ script/runner -e
development "
GetRssData.find_and_parse"
Loaded suite script/runner
Started
Finished in 0.001333 seconds.
0 tests, 0 assertions, 0 failures, 0 errors

I just ran into that myself, what’s going on here…

Did you ever resolve this issue?


Matthew B. :: [email protected]
Resume & Portfolio @ http://madhatted.com

The environment running cron seems to not know about gems. Check that
the
cron user can properly run ruby scripts / has access to use gems.

Jason

Jason R. wrote:

The environment running cron seems to not know about gems. Check that
the
cron user can properly run ruby scripts / has access to use gems.

Well, that as the cron error, I was actually running into the first one,
the tests spewing out of script/runner.

It turned out file_column is requiring it’s tests in init.rb, so I’m
guessing that triggered some sort of test mode. I just commented them
out and everything cleaned up.

Thanks though,


Matthew B. :: [email protected]
Resume & Portfolio @ http://madhatted.com

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs