diff --git a/class/core/system_api.py b/class/core/system_api.py index 2de1259f7..a54533e1e 100755 --- a/class/core/system_api.py +++ b/class/core/system_api.py @@ -103,7 +103,8 @@ class system_api: @async def restartMw(self): sleep(1) - cmd = public.getRunDir() + '/scripts/init.d/mw reload' + cmd = public.getRunDir() + '/scripts/init.d/mw restart' + #print cmd public.execShell(cmd) @async diff --git a/task.py b/task.py index 8edaf1cbb..af180cfef 100755 --- a/task.py +++ b/task.py @@ -7,6 +7,7 @@ import sys import os import json import time +import threading # print sys.path sys.path.append("/usr/local/lib/python2.7/site-packages") @@ -38,6 +39,19 @@ if not os.path.exists(isTask): os.system("touch " + isTask) +def async(f): + def wrapper(*args, **kwargs): + thr = threading.Thread(target=f, args=args, kwargs=kwargs) + thr.start() + return wrapper + +@async +def restartMw(): + sleep(1) + cmd = public.getRunDir() + '/scripts/init.d/mw restart' + public.execShell(cmd) + + class MyBad(): _msg = None @@ -326,9 +340,7 @@ def systemTask(): reloadNum += 1 if reloadNum > 1440: reloadNum = 0 - # if os.path.exists('data/ssl.pl'): - cmd = public.getRunDir() + '/scripts/init.d/mw restart > /dev/null 2>&1' - os.system(cmd) + restartMw() except Exception, ex: print str(ex) @@ -428,7 +440,7 @@ def checkPHPVersion(version): if __name__ == "__main__": - import threading + t = threading.Thread(target=systemTask) t.setDaemon(True) t.start()