Guest User

Untitled

a guest
Jun 21st, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. #!/usr/bin/env ruby
  2. RAILS_ENV = 'development'
  3. require File.dirname(__FILE__) + '/../config/environment'
  4.  
  5. temp_file = File.join(RAILS_ROOT, 'tmp', 'run-index')
  6. config = File.join(RAILS_ROOT, 'config', "#{RAILS_ENV}.sphinx.conf")
  7.  
  8. loop do
  9. if File.exist?(temp_file)
  10. FileUtils.rm(temp_file)
  11. sleep(2)
  12. cmd = "indexer --config #{config} --all --rotate"
  13. print "Indexing..."
  14. $stdout.flush
  15. started_at = Time.now
  16. output = `#{cmd}`
  17. puts " done [Took: #{Time.now - started_at}]"
  18. end
  19. sleep 5
  20. end
Add Comment
Please, Sign In to add comment