This commit is contained in:
midoks
2018-12-02 12:58:59 +08:00
parent 5e7fa28feb
commit 47c1394de6
5 changed files with 37 additions and 16 deletions
+21 -2
View File
@@ -30,6 +30,17 @@ class system_api:
except:
return False
# 检查端口是否占用
def isOpen(self, port):
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
s.connect(('127.0.0.1', int(port)))
s.shutdown(2)
return True
except:
return False
# 检测指定进程是否存活
def checkProcess(self, pid):
try:
@@ -428,10 +439,9 @@ class system_api:
start, end)).field('id,pro,one,five,fifteen,addtime').order('id asc').select()
return self.toAddtime(data)
# 格式化addtime列
def toAddtime(self, data, tomem=False):
import time
# 格式化addtime列
if tomem:
import psutil
mPre = (psutil.virtual_memory().total / 1024 / 1024) / 100
@@ -466,6 +476,15 @@ class system_api:
count = 0
return tmp
def setControl(self, stype, day):
filename = 'data/control.conf'
if stype == '0':
public.execShell("rm -f " + filename)
return public.returnMsg(True, "设置成功!")
# 重启面板
def reWeb(self, get):
# if not public.IsRestart(): return