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