diff --git a/plugins/sphinx/conf/sphinx.conf b/plugins/sphinx/conf/sphinx.conf index 6ee7605d6..96a83a137 100755 --- a/plugins/sphinx/conf/sphinx.conf +++ b/plugins/sphinx/conf/sphinx.conf @@ -20,5 +20,5 @@ searchd preopen_indexes = 1 unlink_old = 1 #workers = threads # for RT to work - binlog_path = {$SERVER_APP}/index + binlog_path = {$SERVER_APP}/index/binlog } diff --git a/plugins/sphinx/index.py b/plugins/sphinx/index.py index bd962c8cd..de4522c14 100755 --- a/plugins/sphinx/index.py +++ b/plugins/sphinx/index.py @@ -79,6 +79,15 @@ def status(): return 'start' +def mkdirAll(): + content = public.readFile(getConf()) + rep = 'path\s*=\s*(.*)' + p = re.compile(rep) + tmp = p.findall(content) + for x in tmp: + public.execShell('mkdir -p ' + x) + + def initDreplace(): file_tpl = getInitDTpl() @@ -102,31 +111,32 @@ def initDreplace(): conf_content = contentReplace(conf_content) public.writeFile(getServerDir() + '/sphinx.conf', conf_content) + mkdirAll() return file_bin def start(): file = initDreplace() data = public.execShell(file + ' start') - if data[0] == '': + if data[1] == '': return 'ok' - return data[0] + return data[1] def stop(): file = initDreplace() data = public.execShell(file + ' stop') - if data[0] == '': + if data[1] == '': return 'ok' - return data[0] + return data[1] def restart(): file = initDreplace() data = public.execShell(file + ' restart') - if data[0] == '': + if data[1] == '': return 'ok' - return data[0] + return data[1] def reload(): @@ -137,6 +147,14 @@ def reload(): return 'fail' +def rebuild(): + file = initDreplace() + data = public.execShell(file + ' rebuild') + if data[1] == '': + return 'ok' + return 'fail' + + def initdStatus(): if not app_debug: if public.isAppleSystem(): @@ -196,6 +214,8 @@ if __name__ == "__main__": print restart() elif func == 'reload': print reload() + elif func == 'rebuild': + print rebuild() elif func == 'initd_status': print initdStatus() elif func == 'initd_install': diff --git a/plugins/sphinx/init.d/sphinx.tpl b/plugins/sphinx/init.d/sphinx.tpl index 54b54a102..4652aa078 100644 --- a/plugins/sphinx/init.d/sphinx.tpl +++ b/plugins/sphinx/init.d/sphinx.tpl @@ -33,7 +33,7 @@ start () { } rebuild () { - ${APP_PATH}/bin/bin/indexer -c ${APP_CONF} --all --rotate + ${APP_PATH}/bin/bin/indexer -c ${APP_CONF} --all --rotate & }