This commit is contained in:
parent
c3cf5deda5
commit
c5dcd09712
|
|
@ -17,7 +17,7 @@ sys.path.append(os.getcwd() + "/class/")
|
|||
import db
|
||||
|
||||
from random import Random
|
||||
from flask import jsonify
|
||||
# from flask import jsonify
|
||||
|
||||
|
||||
def getRunDir():
|
||||
|
|
@ -76,6 +76,11 @@ def retJson(status, msg, data=()):
|
|||
return jsonify({'status': status, 'msg': msg, 'data': data})
|
||||
|
||||
|
||||
def getJson(data):
|
||||
import json
|
||||
return json.dumps(data)
|
||||
|
||||
|
||||
def returnJson(status, msg, args=()):
|
||||
# 取通用Json返回
|
||||
return getJson(returnMsg(status, msg, args))
|
||||
|
|
@ -244,9 +249,11 @@ def GetLastLine(inputfile, lineNum):
|
|||
# 读文件指定倒数行数
|
||||
try:
|
||||
fp = open(inputfile, 'r')
|
||||
print fp
|
||||
lastLine = ""
|
||||
|
||||
lines = fp.readlines()
|
||||
print lines
|
||||
count = len(lines)
|
||||
if count > lineNum:
|
||||
num = lineNum
|
||||
|
|
@ -263,12 +270,16 @@ def GetLastLine(inputfile, lineNum):
|
|||
|
||||
result = ''
|
||||
lineNum -= 1
|
||||
print lastre
|
||||
while lineNum > 0:
|
||||
result += lastre[lineNum] + "\n"
|
||||
print lineNum
|
||||
# lastre[lineNum]
|
||||
# result += lastre[lineNum] + "\n"
|
||||
lineNum -= 1
|
||||
|
||||
return result
|
||||
except:
|
||||
except (IOError, ZeroDivisionError), e:
|
||||
# print e.message
|
||||
return getMsg('TASK_SLEEP')
|
||||
|
||||
|
||||
|
|
@ -350,20 +361,18 @@ def GetLocalIp():
|
|||
# except:
|
||||
# return web.ctx.host.split(':')[0]
|
||||
|
||||
# 搜索数据中是否存在
|
||||
|
||||
|
||||
def inArray(arrays, searchStr):
|
||||
# 搜索数据中是否存在
|
||||
for key in arrays:
|
||||
if key == searchStr:
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
# 检查Web服务器配置文件是否有错误
|
||||
|
||||
|
||||
def checkWebConfig():
|
||||
# 检查Web服务器配置文件是否有错误
|
||||
if get_webserver() == 'nginx':
|
||||
result = ExecShell(
|
||||
"ulimit -n 10240 && /www/server/nginx/sbin/nginx -t -c /www/server/nginx/conf/nginx.conf")
|
||||
|
|
|
|||
|
|
@ -1,16 +1,17 @@
|
|||
{
|
||||
"title":"宝塔跑分",
|
||||
"title":"MW跑分",
|
||||
"tip":"lib",
|
||||
"name":"score",
|
||||
"type":"扩展",
|
||||
"ps":"测试服务器基础性能!",
|
||||
"versions":"1.3",
|
||||
"shell":"score.sh",
|
||||
"install":"install.sh",
|
||||
"uninstall":"uninstall.sh",
|
||||
"checks":"/www/server/panel/plugin/score",
|
||||
"author":"宝塔",
|
||||
"home":"http://www.bt.cn/bbs",
|
||||
"date":"2017-10-16",
|
||||
"author":"mdserver-web",
|
||||
"home":"github.com/midoks/mdserver-web",
|
||||
"date":"2018-11-02",
|
||||
"default":false,
|
||||
"display":0,
|
||||
"pid":"2"
|
||||
"pid":"4"
|
||||
}
|
||||
|
|
@ -53,9 +53,4 @@ Uninstall_score()
|
|||
}
|
||||
|
||||
|
||||
action=$1
|
||||
if [ "${1}" == 'install' ];then
|
||||
Install_score
|
||||
else
|
||||
Uninstall_score
|
||||
fi
|
||||
Install_score
|
||||
|
|
|
|||
|
|
@ -0,0 +1,4 @@
|
|||
download.bt.cn
|
||||
103.224.251.67
|
||||
128.1.164.196
|
||||
125.88.182.172
|
||||
|
|
@ -25,7 +25,9 @@ def GetDiskInfo():
|
|||
|
||||
@files.route('/GetExecLog', methods=['POST'])
|
||||
def GetExecLog():
|
||||
|
||||
file = os.getcwd() + "/tmp/panelExec.log"
|
||||
print file
|
||||
v = public.GetLastLine(file, 100)
|
||||
return v
|
||||
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ def install():
|
|||
|
||||
public.M('tasks').add('id,name,type,status,addtime, execstr', taskAdd)
|
||||
|
||||
return public.retJson(True, '已将安装任务添加到队列!')
|
||||
return public.returnJson(True, '已将安装任务添加到队列!')
|
||||
|
||||
|
||||
@plugins.route('/uninstall', methods=['POST'])
|
||||
|
|
|
|||
Loading…
Reference in New Issue