pull/109/head
Mr Chen 7 years ago
parent e694a7d0eb
commit 2f8d37d556
  1. 2
      .gitignore
  2. 5
      class/public.py
  3. 2
      plugins/score/info.json
  4. 59
      plugins/score/install.sh
  5. 4
      plugins/score/ping.pl
  6. 2
      static/js/soft.js
  7. 1
      tmp/panelTask.pl

2
.gitignore vendored

@ -106,3 +106,5 @@ venv.bak/
.DS_Store
.idea/*.xml
.idea/*.iml
tmp/*.pl
tmp/*.log

@ -248,7 +248,6 @@ def getLastLine(inputfile, lineNum):
lastLine = ""
lines = fp.readlines()
count = len(lines)
if count > lineNum:
num = lineNum
@ -265,9 +264,7 @@ def getLastLine(inputfile, lineNum):
result = ''
num -= 1
while num > 0:
print num
lastre[num]
while num >= 0:
result += lastre[num] + "\n"
num -= 1
return result

@ -6,7 +6,7 @@
"ps":"测试服务器基础性能!",
"versions":"1.3",
"shell":"install.sh",
"checks":"/www/server/panel/plugin/score",
"checks":"plugin/score",
"author":"mdserver-web",
"home":"github.com/midoks/mdserver-web",
"date":"2018-11-02",

@ -1,56 +1,43 @@
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
install_tmp='/tmp/bt_install.pl'
CN='125.88.182.172'
HK='download.bt.cn'
HK2='103.224.251.67'
US='128.1.164.196'
sleep 0.5;
CN_PING=`ping -c 1 -w 1 $CN|grep time=|awk '{print $7}'|sed "s/time=//"`
HK_PING=`ping -c 1 -w 1 $HK|grep time=|awk '{print $7}'|sed "s/time=//"`
HK2_PING=`ping -c 1 -w 1 $HK2|grep time=|awk '{print $7}'|sed "s/time=//"`
US_PING=`ping -c 1 -w 1 $US|grep time=|awk '{print $7}'|sed "s/time=//"`
echo "$HK_PING $HK" > ping.pl
echo "$HK2_PING $HK2" >> ping.pl
echo "$US_PING $US" >> ping.pl
echo "$CN_PING $CN" >> ping.pl
nodeAddr=`sort -V ping.pl|sed -n '1p'|awk '{print $2}'`
if [ "$nodeAddr" == "" ];then
nodeAddr=$HK2
fi
curPath=`pwd`
rootPath=$(dirname "$curPath")
rootPath=$(dirname "$rootPath")
install_tmp=${rootPath}'/tmp/bt_install.pl'
echo $curPath
download_Url=http://$nodeAddr:5880
Install_score()
{
echo '正在安装脚本文件...' > $install_tmp
mkdir -p /www/server/panel/plugin/score
wget -O /www/server/panel/plugin/score/score_main.py $download_Url/install/lib/plugin/score/score_main.py -T 5
sleep 0.1;
wget -O /www/server/panel/plugin/score/index.html $download_Url/install/lib/plugin/score/index.html -T 5
sleep 0.1;
wget -O /www/server/panel/plugin/score/testcpu.c $download_Url/install/lib/plugin/score/testcpu.c -T 5
gcc /www/server/panel/plugin/score/testcpu.c -o /www/server/panel/plugin/score/testcpu -lpthread
if [ ! -f '/www/server/panel/plugin/score/testcpu' ];then
sleep 0.1
gcc /www/server/panel/plugin/score/testcpu.c -o /www/server/panel/plugin/score/testcpu -lpthread
fi
# gcc /www/server/mdserver-web/plugin/score/testcpu.c -o /www/server/mdserver-web/plugin/score/testcpu -lpthread
# if [ ! -f '/www/server/mdserver-web/plugin/score/testcpu' ];then
# sleep 0.1
# gcc /www/server/mdserver-web/plugin/score/testcpu.c -o /www/server/mdserver-web/plugin/score/testcpu -lpthread
# fi
if [ ! -f '/www/server/panel/static/img/soft_ico/ico-score.png' ];then
wget -O /www/server/panel/static/img/soft_ico/ico-score.png $download_Url/install/lib/plugin/score/img/ico-score.png
fi
wget -O /www/server/panel/plugin/score/info.json $download_Url/install/lib/plugin/score/info.json -T 5
echo '安装完成' > $install_tmp
}
Uninstall_score()
{
rm -rf /www/server/panel/plugin/score
echo '卸载完成' > $install_tmp
}
Install_score
action=$1
echo $action
if [ "${1}" == 'install' ];then
Install_score
else
Uninstall_score
fi

@ -1,4 +0,0 @@
download.bt.cn
103.224.251.67
128.1.164.196
125.88.182.172

@ -2040,7 +2040,7 @@ function AddVersion(name, ver, type, obj, title) {
if (type == "lib") {
layer.confirm(lan.get('install_confirm', [title, ver]), { icon: 3, closeBtn: 2 }, function() {
$(obj).text(lan.soft.install_the);
var data = "name=" + name;
var data = "name=" + name+"&version="+ver;
var loadT = layer.msg(lan.soft.the_install, { icon: 16, time: 0, shade: [0.3, '#000'] });
$.post("/plugins/install", data, function(rdata) {
layer.close(loadT);

Loading…
Cancel
Save