Sha256: 267570b016d73412b63186361ed548c8188db18750ab5e897f5984d21211cd15

Contents?: true

Size: 1.6 KB

Versions: 12

Compression:

Stored size: 1.6 KB

Contents

#!/usr/bin/env ruby
begin
  require 'fileutils'
  require 'tempfile'
  require 'tmpdir'
  require 'optparse'
  require File.join(File.dirname(__FILE__), '..', 'lib', 'sunspot', 'solr', 'server')
rescue LoadError => e
  if require 'rubygems'
    retry
  else
    raise(e)
  end
end

server = Sunspot::Solr::Server.new

opts = OptionParser.new do |opts|
  opts.banner = "Usage: sunspot-solr (start|stop|run) [options]"

  opts.on '-p', '--port=PORT', 'Port on which to run Solr (default 8983)' do |p|
    server.port = p
  end

  opts.on '-b', '--bind-address=address', 'Interface on which to run Solr (default 0.0.0.0)' do |b|
    server.bind_address = b
  end

  opts.on '-s', '--solr-home=HOME', 'Solr home directory (should contain conf/ directory)' do |s|
    server.solr_home = File.expand_path(s)
  end

  opts.on '-j', '--solr-jar=JAR', 'Solr start jar' do |j|
    server.solr_jar = File.expand_path(j)
  end

  opts.on '--pid-dir=PID_DIR', 'Directory for pid files' do |pd|
    server.pid_dir = File.expand_path(pd)
  end

  opts.on '-l', '--log-level=LOG_LEVEL', 'Solr logging level' do |l|
    server.log_level = l
  end

  opts.on '--log-file=LOG_FILE', 'Path to Solr log file' do |lf|
    server.log_file = File.expand_path(lf)
  end

  opts.on '--memory=MEMORY', 'Specify the size of the memory allocation pool' do |m|
    server.memory = m
  end
end

opts.parse!

begin
  case ARGV[0]
  when 'start'
    server.start
  when 'run'
    server.run
  when 'stop'
    server.stop
  when 'restart'
    server.stop
    server.start
  else
    abort(opts.help)
  end
rescue Sunspot::Solr::Server::ServerError => e
  abort(e.message)
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
sunspot_solr-2.7.1 bin/sunspot-solr
sunspot_solr-2.7.0 bin/sunspot-solr
sunspot_solr-2.6.0 bin/sunspot-solr
sunspot_solr-2.5.0 bin/sunspot-solr
sunspot_solr-2.4.0 bin/sunspot-solr
sunspot_solr-2.3.0 bin/sunspot-solr
sunspot_solr-2.2.8 bin/sunspot-solr
sunspot_solr-2.2.7 bin/sunspot-solr
sunspot_solr-2.2.6 bin/sunspot-solr
sunspot_solr-2.2.5 bin/sunspot-solr
sunspot_solr-2.2.4 bin/sunspot-solr
sunspot_solr-2.2.3 bin/sunspot-solr