From 5227e66531235c5b570cbf1c3d56d1a63000b93f Mon Sep 17 00:00:00 2001 From: midoks Date: Wed, 22 Jun 2022 13:19:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96openresty=E9=87=8D=E5=90=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- class/core/mw.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/class/core/mw.py b/class/core/mw.py index 745d1c5d1..5629d57ac 100755 --- a/class/core/mw.py +++ b/class/core/mw.py @@ -111,9 +111,22 @@ def isInstalledWeb(): def restartWeb(): - if isInstalledWeb(): - initd = getServerDir() + '/openresty/init.d/openresty' + if not isInstalledWeb(): + return False + + # systemd + systemd = '/lib/systemd/system/openresty.service' + if os.path.exists(systemd): + execShell('systemctl restart openresty') + return True + + # initd + initd = getServerDir() + '/openresty/init.d/openresty' + if os.path.exists(initd): execShell(initd + ' ' + 'restart') + return True + + return False def restartMw():