From 2f50a2ffa0d4cc250330092db84e02406550e1d7 Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Wed, 2 Oct 2024 03:51:37 +0800 Subject: [PATCH] update --- plugins/pgadmin/index.py | 8 ++++++++ plugins/pgadmin/init.d/pgadmin.service.tpl | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/plugins/pgadmin/index.py b/plugins/pgadmin/index.py index eff0f51ffc..178d42804a 100755 --- a/plugins/pgadmin/index.py +++ b/plugins/pgadmin/index.py @@ -175,6 +175,11 @@ def cleanNginxLog(): cmd = "echo '' > " + i mw.execShell(cmd) +def getPythonName(): + cmd = "ls /www/server/pgadmin/run/lib/ | grep python | cut -d \\ -f 1 | awk 'END {print}'" + data = mw.execShell(cmd) + return data[0].strip(); + def initPgConfFile(): file_tpl = getPluginDir() + '/conf/config_local.py' dst_file = getServerDir()+'/run/lib/python3.10/site-packages/pgadmin4/config_local.py' @@ -225,6 +230,9 @@ def initReplace(): service_path = mw.getServerDir() content = mw.readFile(systemServiceTpl) content = content.replace('{$SERVER_PATH}', service_path) + content = content.replace('{$PY_VER}', getPythonName()) + + mw.writeFile(systemService, content) mw.execShell('systemctl daemon-reload') diff --git a/plugins/pgadmin/init.d/pgadmin.service.tpl b/plugins/pgadmin/init.d/pgadmin.service.tpl index 562842036a..ff854f287f 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}/pgadmin/run/lib/python3.10/site-packages/pgadmin4 pgAdmin4:app +ExecStart=gunicorn --bind unix:/tmp/pgadmin4.sock --workers=1 --threads=25 --chdir {$SERVER_PATH}/pgadmin/run/lib/{$PY_VER}/site-packages/pgadmin4 pgAdmin4:app ExecReload=/bin/kill -USR2 $MAINPID PrivateTmp=false