diff --git a/plugins/memcached/index.py b/plugins/memcached/index.py index f6bbeabf3..4e8c857ba 100755 --- a/plugins/memcached/index.py +++ b/plugins/memcached/index.py @@ -180,8 +180,7 @@ def saveConf(): def initdStatus(): if not app_debug: - os_name = public.getOs() - if os_name == 'darwin': + if public.isAppleSystem(): return "Apple Computer does not support" initd_bin = getInitDFile() if os.path.exists(initd_bin): @@ -192,8 +191,7 @@ def initdStatus(): def initdInstall(): import shutil if not app_debug: - os_name = public.getOs() - if os_name == 'darwin': + if public.isAppleSystem(): return "Apple Computer does not support" mem_bin = initDreplace() @@ -205,8 +203,7 @@ def initdInstall(): def initdUinstall(): if not app_debug: - os_name = public.getOs() - if os_name == 'darwin': + if public.isAppleSystem(): return "Apple Computer does not support" initd_bin = getInitDFile() os.remove(initd_bin) diff --git a/plugins/sphinx/conf/sphinx.conf b/plugins/sphinx/conf/sphinx.conf index 816193a9d..6ee7605d6 100755 --- a/plugins/sphinx/conf/sphinx.conf +++ b/plugins/sphinx/conf/sphinx.conf @@ -11,14 +11,14 @@ searchd { listen = 9312 listen = 9306:mysql41 - log = {$SERVER_PATH}/index/searchd.log - query_log = {$SERVER_PATH}/index/query.log + log = {$SERVER_APP}/index/searchd.log + query_log = {$SERVER_APP}/index/query.log read_timeout = 5 max_children = 0 - pid_file = {$SERVER_PATH}/index/searchd.pid + pid_file = {$SERVER_APP}/index/searchd.pid seamless_rotate = 1 preopen_indexes = 1 unlink_old = 1 #workers = threads # for RT to work - binlog_path = {$SERVER_PATH}/index/binlog/ + binlog_path = {$SERVER_APP}/index } diff --git a/plugins/sphinx/index.html b/plugins/sphinx/index.html index 4af4424b3..2c1b3341b 100755 --- a/plugins/sphinx/index.html +++ b/plugins/sphinx/index.html @@ -4,7 +4,8 @@

服务

自启动

配置修改

-

日志

+

运行日志

+

查询日志

diff --git a/plugins/sphinx/index.py b/plugins/sphinx/index.py index 03e0bb29b..96b56e0b7 100755 --- a/plugins/sphinx/index.py +++ b/plugins/sphinx/index.py @@ -4,7 +4,7 @@ import sys import io import os import time - +import re sys.path.append(os.getcwd() + "/class/core") import public @@ -67,6 +67,8 @@ def contentReplace(content): service_path = public.getServerDir() content = content.replace('{$ROOT_PATH}', public.getRootDir()) content = content.replace('{$SERVER_PATH}', service_path) + content = content.replace('{$SERVER_APP}', service_path + '/sphinx') + return content def status(): @@ -89,7 +91,7 @@ def initDreplace(): # initd replace content = public.readFile(file_tpl) - content = content.replace('{$SERVER_PATH}', service_path) + content = contentReplace(content) public.writeFile(file_bin, content) public.execShell('chmod +x ' + file_bin) @@ -167,6 +169,21 @@ def initdUinstall(): return 'ok' +def runLog(): + path = getConf() + content = public.readFile(path) + rep = 'log\s*=\s*(.*)' + tmp = re.search(rep, content) + return tmp.groups()[0] + + +def queryLog(): + path = getConf() + content = public.readFile(path) + rep = 'query_log\s*=\s*(.*)' + tmp = re.search(rep, content) + return tmp.groups()[0] + if __name__ == "__main__": func = sys.argv[1] if func == 'status': @@ -185,11 +202,11 @@ if __name__ == "__main__": print initdInstall() elif func == 'initd_uninstall': print initdUinstall() - elif func == 'run_info': - print runInfo() elif func == 'conf': print getConf() elif func == 'run_log': print runLog() + elif func == 'query_log': + print queryLog() else: print 'error'