pull/109/head
midoks 7 years ago
parent c3cf5deda5
commit c5dcd09712
  1. 23
      class/public.py
  2. 13
      plugins/score/info.json
  3. 7
      plugins/score/install.sh
  4. 4
      plugins/score/ping.pl
  5. 2
      route/files.py
  6. 2
      route/plugins.py

@ -17,7 +17,7 @@ sys.path.append(os.getcwd() + "/class/")
import db import db
from random import Random from random import Random
from flask import jsonify # from flask import jsonify
def getRunDir(): def getRunDir():
@ -76,6 +76,11 @@ def retJson(status, msg, data=()):
return jsonify({'status': status, 'msg': msg, 'data': data}) return jsonify({'status': status, 'msg': msg, 'data': data})
def getJson(data):
import json
return json.dumps(data)
def returnJson(status, msg, args=()): def returnJson(status, msg, args=()):
# 取通用Json返回 # 取通用Json返回
return getJson(returnMsg(status, msg, args)) return getJson(returnMsg(status, msg, args))
@ -244,9 +249,11 @@ def GetLastLine(inputfile, lineNum):
# 读文件指定倒数行数 # 读文件指定倒数行数
try: try:
fp = open(inputfile, 'r') fp = open(inputfile, 'r')
print fp
lastLine = "" lastLine = ""
lines = fp.readlines() lines = fp.readlines()
print lines
count = len(lines) count = len(lines)
if count > lineNum: if count > lineNum:
num = lineNum num = lineNum
@ -263,12 +270,16 @@ def GetLastLine(inputfile, lineNum):
result = '' result = ''
lineNum -= 1 lineNum -= 1
print lastre
while lineNum > 0: while lineNum > 0:
result += lastre[lineNum] + "\n" print lineNum
# lastre[lineNum]
# result += lastre[lineNum] + "\n"
lineNum -= 1 lineNum -= 1
return result return result
except: except (IOError, ZeroDivisionError), e:
# print e.message
return getMsg('TASK_SLEEP') return getMsg('TASK_SLEEP')
@ -350,20 +361,18 @@ def GetLocalIp():
# except: # except:
# return web.ctx.host.split(':')[0] # return web.ctx.host.split(':')[0]
# 搜索数据中是否存在
def inArray(arrays, searchStr): def inArray(arrays, searchStr):
# 搜索数据中是否存在
for key in arrays: for key in arrays:
if key == searchStr: if key == searchStr:
return True return True
return False return False
# 检查Web服务器配置文件是否有错误
def checkWebConfig(): def checkWebConfig():
# 检查Web服务器配置文件是否有错误
if get_webserver() == 'nginx': if get_webserver() == 'nginx':
result = ExecShell( result = ExecShell(
"ulimit -n 10240 && /www/server/nginx/sbin/nginx -t -c /www/server/nginx/conf/nginx.conf") "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", "tip":"lib",
"name":"score", "name":"score",
"type":"扩展", "type":"扩展",
"ps":"测试服务器基础性能!", "ps":"测试服务器基础性能!",
"versions":"1.3", "versions":"1.3",
"shell":"score.sh", "install":"install.sh",
"uninstall":"uninstall.sh",
"checks":"/www/server/panel/plugin/score", "checks":"/www/server/panel/plugin/score",
"author":"宝塔", "author":"mdserver-web",
"home":"http://www.bt.cn/bbs", "home":"github.com/midoks/mdserver-web",
"date":"2017-10-16", "date":"2018-11-02",
"default":false, "default":false,
"display":0, "display":0,
"pid":"2" "pid":"4"
} }

@ -53,9 +53,4 @@ Uninstall_score()
} }
action=$1 Install_score
if [ "${1}" == 'install' ];then
Install_score
else
Uninstall_score
fi

@ -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']) @files.route('/GetExecLog', methods=['POST'])
def GetExecLog(): def GetExecLog():
file = os.getcwd() + "/tmp/panelExec.log" file = os.getcwd() + "/tmp/panelExec.log"
print file
v = public.GetLastLine(file, 100) v = public.GetLastLine(file, 100)
return v return v

@ -101,7 +101,7 @@ def install():
public.M('tasks').add('id,name,type,status,addtime, execstr', taskAdd) public.M('tasks').add('id,name,type,status,addtime, execstr', taskAdd)
return public.retJson(True, '已将安装任务添加到队列!') return public.returnJson(True, '已将安装任务添加到队列!')
@plugins.route('/uninstall', methods=['POST']) @plugins.route('/uninstall', methods=['POST'])

Loading…
Cancel
Save