mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-18 23:45:52 +08:00
update
This commit is contained in:
@@ -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'
|
||||
|
||||
@@ -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
|
||||
@@ -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 $?
|
||||
Reference in New Issue
Block a user