Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I have a script written with jRuby and I need this script to be executed from rails app (which runs on MRI ruby). I have code like this:

class User < ActiveRecord::Base
  def run_script!
    system "jruby /path/to/my/script/script.rb #{id}"
  end
end

and it works in development! But on Ubuntu production server it returns nil and I have no idea how to make it work.

share|improve this question

1 Answer

From the Kernel#system documentation:

Returns nil if command execution fails. An error status is available in $?.

So what does $? tell you?

share|improve this answer
exit 127 Seems like I don't have jruby in my PATH – makaroni4 Oct 13 '12 at 22:55
If I specify the path to jruby I get this: Could not find rake-0.9.2.2 in any of the sources Run 'bundle install' to install missing gems. – makaroni4 Oct 13 '12 at 23:01
@makaroni4: What dependencies does script.rb have and how are you managing them? – pje Oct 16 '12 at 1:44
Just require 'java', I solved my problem moving jRuby code to daemon, it is much more clearer than execute script from MRI Rails app imho – makaroni4 Oct 22 '12 at 14:34

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.