update
This commit is contained in:
parent
4dfa41950e
commit
3b7e56b4cf
|
|
@ -15,6 +15,17 @@ import public
|
|||
import config
|
||||
|
||||
|
||||
from threading import Thread
|
||||
from time import sleep
|
||||
|
||||
|
||||
def async(f):
|
||||
def wrapper(*args, **kwargs):
|
||||
thr = Thread(target=f, args=args, kwargs=kwargs)
|
||||
thr.start()
|
||||
return wrapper
|
||||
|
||||
|
||||
class system_api:
|
||||
setupPath = None
|
||||
pids = None
|
||||
|
|
@ -72,12 +83,18 @@ class system_api:
|
|||
|
||||
# 重启面板
|
||||
def restartApi(self):
|
||||
cmd = public.getRunDir() + '/scripts/init.d/mw start'
|
||||
public.execShell(cmd)
|
||||
self.restartMw()
|
||||
return public.returnJson(True, '面板已重启!')
|
||||
##### ----- end ----- ###
|
||||
|
||||
# 名取PID
|
||||
@async
|
||||
def restartMw(self):
|
||||
sleep(1)
|
||||
print '123123'
|
||||
cmd = public.getRunDir() + '/scripts/init.d/mw reload'
|
||||
print public.execShell(cmd)
|
||||
|
||||
# 名取PID
|
||||
def getPid(self, pname):
|
||||
try:
|
||||
if not self.pids:
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ mw_start(){
|
|||
if [ "$isStart" == '' ];then
|
||||
echo -e "Starting mw... \c"
|
||||
cd $mw_path && gunicorn -c setting.py app:app
|
||||
sleep 0.6
|
||||
sleep 0.2
|
||||
port=$(cat ${mw_path}/data/port.pl)
|
||||
isStart=$(lsof -i :$port|grep LISTEN)
|
||||
if [ "$isStart" == '' ];then
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ bind = ['0.0.0.0:%s' % bt_port]
|
|||
workers = cpu_info[1] + 1
|
||||
threads = 1
|
||||
backlog = 512
|
||||
reload = False
|
||||
reload = True
|
||||
daemon = True
|
||||
timeout = 7200
|
||||
keepalive = 1
|
||||
|
|
|
|||
Loading…
Reference in New Issue