From b76c5251069245a9bf4a63589c272862c712c1b3 Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Tue, 1 Oct 2024 15:21:54 +0800 Subject: [PATCH] update --- plugins/pgadmin/index.py | 22 +++++++++++++--------- plugins/pgadmin/init.d/pgadmin.service.tpl | 2 +- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/plugins/pgadmin/index.py b/plugins/pgadmin/index.py index a89257707..9f2cf2708 100755 --- a/plugins/pgadmin/index.py +++ b/plugins/pgadmin/index.py @@ -175,6 +175,16 @@ def delPort(): return True +def cleanNginxLog(): + log_a = accessLog() + log_e = errorLog() + + for i in [log_a, log_e]: + if os.path.exists(i): + cmd = "echo '' > " + i + mw.execShell(cmd) + + def initReplace(): pma_dir = getServerDir() + "/pgadmin" @@ -213,20 +223,14 @@ def initReplace(): mw.writeFile(systemService, content) mw.execShell('systemctl daemon-reload') + def start(): initCfg() openPort() initReplace() - - log_a = accessLog() - log_e = errorLog() - - for i in [log_a, log_e]: - if os.path.exists(i): - cmd = "echo '' > " + i - mw.execShell(cmd) - + + cleanNginxLog() mw.restartWeb() return 'ok' diff --git a/plugins/pgadmin/init.d/pgadmin.service.tpl b/plugins/pgadmin/init.d/pgadmin.service.tpl index 580c29c0e..0e4a2b737 100644 --- a/plugins/pgadmin/init.d/pgadmin.service.tpl +++ b/plugins/pgadmin/init.d/pgadmin.service.tpl @@ -8,7 +8,7 @@ Description=pgadmin service After=network.target [Service] -ExecStart=gunicorn --bind unix:/tmp/pgadmin4.sock --workers=1 --threads=25 --chdir {$SERVER_PATH}/lib/python3.10/dist-packages/pgadmin4 pgAdmin4:app +ExecStart=gunicorn --bind unix:/tmp/pgadmin4.sock --workers=1 --threads=25 --chdir {$SERVER_PATH}/pgadmin/lib/python3.10/dist-packages/pgadmin4 pgAdmin4:app ExecReload=/bin/kill -USR2 $MAINPID PrivateTmp=false