Skip to content

Instantly share code, notes, and snippets.

@axgle
Forked from tarcieri/gist:226290
Created November 8, 2009 03:16
Show Gist options
  • Save axgle/229072 to your computer and use it in GitHub Desktop.
Save axgle/229072 to your computer and use it in GitHub Desktop.
def run_solr
defs = {
'jetty.home' => @path,
'solr.data.dir' => @path/'solr'/'data'
}.map { |k, v| "-D#{k}=#{v}" }.join(' ')
cmd = "java -jar #{@path}/start.jar #{@path/'etc'/'jetty.xml'} -classpath #{@path/'lib'} #{defs}"
# IO.popen is more portable than fork/exec (i.e. to JRuby)
pid = IO.popen(cmd, 'r').pid
puts "PID: #{pid}"
pid
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment