From 34bc46ce9bef6b685f989aa8a7353d959db91b69 Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Tue, 20 Nov 2018 17:43:29 +0800 Subject: [PATCH] o --- plugins/redis/info.json | 6 +----- plugins/redis/install.sh | 12 ++++++++++- route/task.py | 46 +++++++++++++++++++--------------------- 3 files changed, 34 insertions(+), 30 deletions(-) diff --git a/plugins/redis/info.json b/plugins/redis/info.json index a7ae5f66d..945f5b7cb 100755 --- a/plugins/redis/info.json +++ b/plugins/redis/info.json @@ -5,11 +5,7 @@ "title": "Redis", "shell": "install.sh", "default": false, - "versions":[ - { - "version":"4.0" - } - ], + "versions":["4.0"], "tip": "soft", "checks": "server/redis", "display": 1, diff --git a/plugins/redis/install.sh b/plugins/redis/install.sh index 368bf47f9..4b166bded 100755 --- a/plugins/redis/install.sh +++ b/plugins/redis/install.sh @@ -13,10 +13,20 @@ install_tmp=${rootPath}/tmp/bt_install.pl Install_redis() { + mkdir -p $serverPath/tmp + echo '正在安装脚本文件...' > $install_tmp + wget -O $serverPath/tmp/redis.tar.gz http://download.redis.io/releases/redis-4.0.11.tar.gz + cd $serverPath/tmp && tar -zxvf redis.tar.gz + + mkdir -p $serverPath/redis + cd redis* && make PREFIX=$serverPath/redis install + sed '/^ *#/d' redis.conf > $serverPath/redis/redis.conf + echo '安装完成' > $install_tmp - + + # rm -rf $serverPath/tmp } Uninstall_redis() diff --git a/route/task.py b/route/task.py index ea8000af2..6c2bda5a3 100644 --- a/route/task.py +++ b/route/task.py @@ -54,32 +54,30 @@ def getTaskSpeed(): find = public.M('tasks').where('status=? OR status=?', ('-1', '0')).field('id,type,name,execstr').find() if not len(find): - # pass return public.returnJson(False, '当前没有任务队列在执行-2!') - # isTask = os.getcwd() + '/tmp/panelTask.pl' - # public.writeFile(isTask, 'True') + isTask = os.getcwd() + '/tmp/panelTask.pl' + public.writeFile(isTask, 'True') print find echoMsg = {} - # echoMsg['name'] = find['name'] - # echoMsg['execstr'] = find['execstr'] - # if find['type'] == 'download': - # import json - # try: - # tmp = public.readFile(tempFile) - # if len(tmp) < 10: - # return public.returnMsg(False, '当前没有任务队列在执行-3!') - # echoMsg['msg'] = json.loads(tmp) - # echoMsg['isDownload'] = True - # except: - # db.Sql().table('tasks').where( - # "id=?", (find['id'],)).save('status', ('0',)) - # return public.returnMsg(False, '当前没有任务队列在执行-4!') - # else: - # echoMsg['msg'] = self.GetLastLine(tempFile, 20) - # echoMsg['isDownload'] = False - - # echoMsg['task'] = public.M('tasks').where("status!=?", ('1',)).field( - # 'id,status,name,type').order("id asc").select() - print echoMsg + echoMsg['name'] = find['name'] + echoMsg['execstr'] = find['execstr'] + if find['type'] == 'download': + import json + try: + tmp = public.readFile(tempFile) + if len(tmp) < 10: + return public.returnMsg(False, '当前没有任务队列在执行-3!') + echoMsg['msg'] = json.loads(tmp) + echoMsg['isDownload'] = True + except: + db.Sql().table('tasks').where( + "id=?", (find['id'],)).save('status', ('0',)) + return public.returnMsg(False, '当前没有任务队列在执行-4!') + else: + echoMsg['msg'] = public.getLastLine(tempFile, 20) + echoMsg['isDownload'] = False + + echoMsg['task'] = public.M('tasks').where("status!=?", ('1',)).field( + 'id,status,name,type').order("id asc").select() return public.getJson(echoMsg)