diff --git a/plugins/manticoresearch/index.py b/plugins/manticoresearch/index.py index 0c64520d5..1182403e0 100755 --- a/plugins/manticoresearch/index.py +++ b/plugins/manticoresearch/index.py @@ -125,43 +125,18 @@ def mkdirAll(): else: mw.execShell('mkdir -p ' + os.path.dirname(x)) - def initDreplace(): - file_tpl = getInitDTpl() - service_path = mw.getServerDir() - - # initD_path = getServerDir() + '/init.d' - # if not os.path.exists(initD_path): - # os.mkdir(initD_path) - # file_bin = initD_path + '/' + getPluginName() - - # # initd replace - # if not os.path.exists(file_bin): - # content = mw.readFile(file_tpl) - # content = contentReplace(content) - # mw.writeFile(file_bin, content) - # mw.execShell('chmod +x ' + file_bin) - # config replace conf_bin = getConf() if not os.path.exists(conf_bin): conf_content = mw.readFile(getConfTpl()) conf_content = contentReplace(conf_content) - mw.writeFile(getServerDir() + '/manticore.conf', conf_content) + mw.writeFile(getConf(), conf_content) - # systemd - # systemDir = mw.systemdCfgDir() - # systemService = systemDir + '/sphinx.service' - # systemServiceTpl = getPluginDir() + '/init.d/sphinx.service.tpl' - # if os.path.exists(systemDir) and not os.path.exists(systemService): - # se_content = mw.readFile(systemServiceTpl) - # se_content = se_content.replace('{$SERVER_PATH}', service_path) - # mw.writeFile(systemService, se_content) - # mw.execShell('systemctl daemon-reload') mkdirAll() - return file_bin + return "ok" def checkIndexSph(): @@ -179,6 +154,7 @@ def checkIndexSph(): return True def mcsOp(method): + initDreplace() data = mw.execShell('systemctl ' + method + ' manticore') if data[1] == '': return 'ok' diff --git a/plugins/manticoresearch/init.d/manticoresearch.service.tpl b/plugins/manticoresearch/init.d/manticoresearch.service.tpl deleted file mode 100644 index 5524cef02..000000000 --- a/plugins/manticoresearch/init.d/manticoresearch.service.tpl +++ /dev/null @@ -1,12 +0,0 @@ -[Unit] -Description=Open Source Search Server -After=network.target - -[Service] -Type=forking -ExecStart={$SERVER_PATH}/sphinx/bin/bin/searchd -c {$SERVER_PATH}/sphinx/sphinx.conf -ExecReload=/bin/kill -USR2 $MAINPID -Restart=on-failure - -[Install] -WantedBy=multi-user.target \ No newline at end of file diff --git a/plugins/manticoresearch/init.d/manticoresearch.tpl b/plugins/manticoresearch/init.d/manticoresearch.tpl deleted file mode 100644 index 8de34003c..000000000 --- a/plugins/manticoresearch/init.d/manticoresearch.tpl +++ /dev/null @@ -1,82 +0,0 @@ -#! /bin/bash -# -# searchd: sphinx Daemon -# -# chkconfig: - 90 25 -# description: sphinx Daemon -# -### BEGIN INIT INFO -# Provides: sphinx -# Required-Start: $syslog -# Required-Stop: $syslog -# Should-Start: $local_fs -# Should-Stop: $local_fs -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: sphinx - Document Index Daemon -# Description: sphinx - Document Index Daemon -### END INIT INFO - -APP_PATH={$SERVER_APP} -APP_CONF={$SERVER_APP}/sphinx.conf -prog="sphinx" - -start () { - echo -n $"Starting $prog: " - ${APP_PATH}/bin/bin/searchd -c ${APP_CONF} - if [ "$?" != 0 ] ; then - echo " failed" - exit 1 - else - echo " done" - fi -} - -rebuild () { - ${APP_PATH}/bin/bin/indexer -c ${APP_CONF} --all --rotate -} - - -stop () { - echo -n $"Stopping $prog: " - if [ ! -e ${APP_PATH}/index/searchd.pid ]; then - echo -n $"$prog is not running." - exit 1 - fi - kill `cat ${APP_PATH}/index/searchd.pid` - if [ "$?" != 0 ] ; then - echo " failed" - exit 1 - else - rm -f ${APP_PATH}/index/searchd.pid - echo " done" - fi -} - -restart () { - $0 stop - sleep 2 - $0 start -} - -# See how we were called. -case "$1" in - start) - start - ;; - stop) - stop - ;; - restart|reload) - restart - ;; - rebuild) - rebuild - ;; - *) - echo $"Usage: $0 {start|stop|status|restart|reload}" - exit 1 - ;; -esac - -exit $? \ No newline at end of file