pull/216/head
midoks 3 years ago
parent 65d07d3934
commit fb94fb8304
  1. 9
      class/core/mw.py
  2. 9
      plugins/webstats/index.py
  3. 3
      plugins/webstats/lua/webstats_common.lua

@ -161,19 +161,24 @@ def isInstalledWeb():
def restartWeb(): def restartWeb():
return opWeb("reload")
def opWeb(method):
if not isInstalledWeb(): if not isInstalledWeb():
return False return False
# systemd # systemd
systemd = '/lib/systemd/system/openresty.service' systemd = '/lib/systemd/system/openresty.service'
if os.path.exists(systemd): if os.path.exists(systemd):
execShell('systemctl reload openresty') execShell('systemctl ' + method + ' openresty')
return True return True
# initd # initd
initd = getServerDir() + '/openresty/init.d/openresty' initd = getServerDir() + '/openresty/init.d/openresty'
if os.path.exists(initd): if os.path.exists(initd):
execShell(initd + ' ' + 'reload') execShell(initd + ' ' + method)
return True return True
return False return False

@ -236,7 +236,7 @@ def start():
if not mw.isAppleSystem(): if not mw.isAppleSystem():
mw.execShell("chown -R www:www " + getServerDir()) mw.execShell("chown -R www:www " + getServerDir())
mw.restartWeb() mw.opWeb("reload")
return 'ok' return 'ok'
@ -247,14 +247,14 @@ def stop():
import tool_task import tool_task
tool_task.removeBgTask() tool_task.removeBgTask()
mw.restartWeb() mw.opWeb("restart")
return 'ok' return 'ok'
def restart(): def restart():
initDreplace() initDreplace()
mw.restartWeb() mw.opWeb("reload")
return 'ok' return 'ok'
@ -262,7 +262,8 @@ def reload():
initDreplace() initDreplace()
loadDebugLogFile() loadDebugLogFile()
mw.restartWeb()
mw.opWeb("reload")
return 'ok' return 'ok'

@ -220,6 +220,7 @@ function _M.cron(self)
local timer_every_get_data = function (premature) local timer_every_get_data = function (premature)
local llen, _ = ngx.shared.mw_total:llen(total_key) local llen, _ = ngx.shared.mw_total:llen(total_key)
-- self:D("llen:"..tostring(llen))
if llen == 0 then if llen == 0 then
return true return true
end end
@ -443,7 +444,7 @@ function _M.cron(self)
self:unlock_working(cron_key) self:unlock_working(cron_key)
-- ngx.update_time() ngx.update_time()
-- self:D("--【"..tostring(llen).."】, elapsed: " .. tostring(ngx.now() - begin)) -- self:D("--【"..tostring(llen).."】, elapsed: " .. tostring(ngx.now() - begin))
end end

Loading…
Cancel
Save