diff --git a/.gitignore b/.gitignore index 2c89adcad..0e5c142a1 100644 --- a/.gitignore +++ b/.gitignore @@ -106,3 +106,5 @@ venv.bak/ .DS_Store .idea/*.xml .idea/*.iml +tmp/*.pl +tmp/*.log diff --git a/class/public.py b/class/public.py index 4451a3390..ad9e8c57b 100755 --- a/class/public.py +++ b/class/public.py @@ -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 diff --git a/plugins/score/info.json b/plugins/score/info.json index 50e874447..a7f05923b 100755 --- a/plugins/score/info.json +++ b/plugins/score/info.json @@ -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", diff --git a/plugins/score/install.sh b/plugins/score/install.sh index eed5c3314..5c6fafd37 100755 --- a/plugins/score/install.sh +++ b/plugins/score/install.sh @@ -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 diff --git a/plugins/score/ping.pl b/plugins/score/ping.pl deleted file mode 100644 index 2b7d10846..000000000 --- a/plugins/score/ping.pl +++ /dev/null @@ -1,4 +0,0 @@ - download.bt.cn - 103.224.251.67 - 128.1.164.196 - 125.88.182.172 diff --git a/static/js/soft.js b/static/js/soft.js index 193b5ba71..724c23469 100755 --- a/static/js/soft.js +++ b/static/js/soft.js @@ -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); diff --git a/tmp/panelTask.pl b/tmp/panelTask.pl deleted file mode 100644 index 8b1378917..000000000 --- a/tmp/panelTask.pl +++ /dev/null @@ -1 +0,0 @@ -