Created
October 11, 2011 23:04
-
-
Save moretea/1279742 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| namespace :ts do | |
| # Workaround to make Sphinx run in the foreground | |
| task :run_in_foreground => [ 'ts:conf', 'ts:in' ] do | |
| ts = ThinkingSphinx::Configuration.instance | |
| $kill_sphinx_on_exit = false | |
| unless pid = fork | |
| exec "#{ts.bin_path}#{ts.searchd_binary_name} --pidfile --config #{ts.config_file} --nodetach" | |
| end | |
| $kill_sphinx_on_exit = true | |
| at_exit do | |
| if $kill_sphinx_on_exit | |
| Process.kill(:TERM, pid) | |
| end | |
| end | |
| Process.wait | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment