2

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.

1 Answer 1

3

From the Kernel#system documentation:

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

So what does $? tell you?

Sign up to request clarification or add additional context in comments.

4 Comments

exit 127 Seems like I don't have jruby in my PATH
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: What dependencies does script.rb have and how are you managing them?
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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.