mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-10 05:59:25 +08:00
update
This commit is contained in:
+30
-15
@@ -224,39 +224,54 @@ def initReplace():
|
||||
mw.execShell('systemctl daemon-reload')
|
||||
|
||||
|
||||
def pgOp(method):
|
||||
file = initReplace()
|
||||
|
||||
current_os = mw.getOs()
|
||||
if current_os == "darwin":
|
||||
data = mw.execShell(file + ' ' + method)
|
||||
if data[1] == '':
|
||||
return 'ok'
|
||||
return data[1]
|
||||
|
||||
if current_os.startswith("freebsd"):
|
||||
data = mw.execShell('service' + getPluginName() + ' ' + method)
|
||||
if data[1] == '':
|
||||
return 'ok'
|
||||
return data[1]
|
||||
|
||||
if method == 'stop' or method == 'restart':
|
||||
mw.execShell(file + ' ' + 'stop')
|
||||
|
||||
data = mw.execShell('systemctl ' + method+ '' + getPluginName())
|
||||
if data[1] == '':
|
||||
return 'ok'
|
||||
|
||||
return data[1]
|
||||
|
||||
def start():
|
||||
initCfg()
|
||||
openPort()
|
||||
|
||||
initReplace()
|
||||
|
||||
pgOp('start')
|
||||
|
||||
cleanNginxLog()
|
||||
mw.restartWeb()
|
||||
return 'ok'
|
||||
|
||||
|
||||
def stop():
|
||||
conf = getConf()
|
||||
if os.path.exists(conf):
|
||||
os.remove(conf)
|
||||
pgOp('stop')
|
||||
delPort()
|
||||
mw.restartWeb()
|
||||
return 'ok'
|
||||
|
||||
|
||||
def restart():
|
||||
return start()
|
||||
return pgOp('restart')
|
||||
|
||||
|
||||
def reload():
|
||||
file_tpl = getPluginDir() + '/conf/phpmyadmin.conf'
|
||||
file_run = getConf()
|
||||
if os.path.exists(file_run):
|
||||
centent = mw.readFile(file_tpl)
|
||||
centent = contentReplace(centent)
|
||||
mw.writeFile(file_run, centent)
|
||||
return start()
|
||||
|
||||
return pgOp('reload')
|
||||
|
||||
def getPmaOption():
|
||||
data = getCfg()
|
||||
|
||||
@@ -49,10 +49,6 @@ else
|
||||
OSNAME='unknow'
|
||||
fi
|
||||
|
||||
# if [ -f ${rootPath}/bin/activate ];then
|
||||
# source ${rootPath}/bin/activate
|
||||
# fi
|
||||
|
||||
Install_pgadmin()
|
||||
{
|
||||
# if [ -d $serverPath/pgadmin ];then
|
||||
@@ -83,20 +79,15 @@ Install_pgadmin()
|
||||
|
||||
pip install https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v8.10/pip/pgadmin4-8.10-py3-none-any.whl
|
||||
|
||||
|
||||
|
||||
VER=$1
|
||||
|
||||
echo '安装完成'
|
||||
|
||||
cd ${rootPath} && python3 ${rootPath}/plugins/pgadmin/index.py start
|
||||
|
||||
|
||||
echo '安装完成'
|
||||
}
|
||||
|
||||
Uninstall_pgadmin()
|
||||
{
|
||||
cd ${rootPath} && python3 ${rootPath}/plugins/pgadmin/index.py stop
|
||||
|
||||
rm -rf ${serverPath}/pgadmin
|
||||
echo '卸载完成'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user