Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env ruby
- RAILS_ENV = 'development'
- require File.dirname(__FILE__) + '/../config/environment'
- temp_file = File.join(RAILS_ROOT, 'tmp', 'run-index')
- config = File.join(RAILS_ROOT, 'config', "#{RAILS_ENV}.sphinx.conf")
- loop do
- if File.exist?(temp_file)
- FileUtils.rm(temp_file)
- sleep(2)
- cmd = "indexer --config #{config} --all --rotate"
- print "Indexing..."
- $stdout.flush
- started_at = Time.now
- output = `#{cmd}`
- puts " done [Took: #{Time.now - started_at}]"
- end
- sleep 5
- end
Add Comment
Please, Sign In to add comment