pull/109/head
Mr Chen 6 years ago
parent 0803b7c66b
commit d931d5bb65
  1. 2
      plugins/sphinx/conf/sphinx.conf
  2. 32
      plugins/sphinx/index.py
  3. 2
      plugins/sphinx/init.d/sphinx.tpl

@ -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
}

@ -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':

@ -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 &
}

Loading…
Cancel
Save