diff --git a/plugins/supervisor/index.html b/plugins/supervisor/index.html index f58df6ecc..4300e73a2 100755 --- a/plugins/supervisor/index.html +++ b/plugins/supervisor/index.html @@ -8,7 +8,8 @@

主配置

主日志

子配置

-

子日志

+ +

子日志

diff --git a/plugins/supervisor/index.py b/plugins/supervisor/index.py index 046cf3caa..084dafef0 100755 --- a/plugins/supervisor/index.py +++ b/plugins/supervisor/index.py @@ -235,6 +235,44 @@ def getSupList(): data['data'] = array_list return mw.getJson(data) +def confDList(): + confd_dir = getServerDir() + '/conf.d' + clist = os.listdir(confd_dir) + array_list = [] + for x in range(len(clist)): + t = {} + t['name'] = clist[x] + array_list.append(t) + + data = {} + data['data'] = array_list + return mw.getJson(data) + + +def confDlistTraceLog(): + args = getArgs() + data = checkArgs(args, ['name']) + if not data[0]: + return data[1] + + confd_dir = getServerDir() + '/conf.d/' + args['name'] + content = mw.readFile(confd_dir) + rep = 'stdout_logfile\s*=\s*(.*)' + tmp = re.search(rep, content) + return tmp.groups()[0].strip() + + +def confDlistErrorLog(): + args = getArgs() + data = checkArgs(args, ['name']) + if not data[0]: + return data[1] + + confd_dir = getServerDir() + '/conf.d/' + args['name'] + content = mw.readFile(confd_dir) + rep = 'stderr_logfile\s*=\s*(.*)' + tmp = re.search(rep, content) + return tmp.groups()[0].strip() def getUserListData(): user = getServerDir() + "/user.txt" @@ -586,6 +624,12 @@ if __name__ == "__main__": print(getUserList()) elif func == 'get_sup_list': print(getSupList()) + elif func == 'confd_list': + print(confDList()) + elif func == 'confd_list_trace_log': + print(confDlistTraceLog()) + elif func == 'confd_list_error_log': + print(confDlistErrorLog()) elif func == 'add_job': print(addJob()) elif func == 'start_job': diff --git a/plugins/supervisor/install.sh b/plugins/supervisor/install.sh index 32fce94b9..7e97301b9 100755 --- a/plugins/supervisor/install.sh +++ b/plugins/supervisor/install.sh @@ -22,7 +22,7 @@ fi Install_app() { - echo '正在安装脚本文件...' > $install_tmp + echo '正在安装[supervisor]...' mkdir -p $serverPath/source mkdir -p $serverPath/supervisor mkdir -p $serverPath/supervisor/log @@ -39,10 +39,11 @@ Install_app() fi echo "${VERSION}" > $serverPath/supervisor/version.pl - echo '安装完成[supervisor]' > $install_tmp cd ${rootPath} && python3 ${rootPath}/plugins/supervisor/index.py start cd ${rootPath} && python3 ${rootPath}/plugins/supervisor/index.py initd_install + + echo '安装完成[supervisor]' } Uninstall_app() @@ -60,7 +61,7 @@ Uninstall_app() rm -rf $serverPath/supervisor - echo "卸载完成[supervisor]" > $install_tmp + echo "卸载完成[supervisor]" } action=$1 diff --git a/plugins/supervisor/js/supervisor.js b/plugins/supervisor/js/supervisor.js index ba9b16641..4ed1a7dbb 100755 --- a/plugins/supervisor/js/supervisor.js +++ b/plugins/supervisor/js/supervisor.js @@ -556,3 +556,70 @@ function supLogs(_name, config_tpl_func, read_config_tpl_func,line){ } +function confdListTraceLog(name){ + var args = {}; + args["name"] = name; + pluginRollingLogs("supervisor", '', "confd_list_trace_log", JSON.stringify(args), 21); +} + +function confdListErrLog(name){ + var args = {}; + args["name"] = name; + pluginRollingLogs("supervisor", '', "confd_list_error_log", JSON.stringify(args), 21); +} + +function confdList(page, search){ + var _data = {}; + if (typeof(page) =='undefined'){ + var page = 1; + } + + _data['page'] = page; + _data['page_size'] = 10; + if(typeof(search) != 'undefined'){ + _data['search'] = search; + } + + myPost('confd_list', _data, function(data){ + var rdata = $.parseJSON(data.data); + // console.log(rdata.data); + var list = ''; + for(i in rdata.data){ + list += ''; + list += '' + rdata.data[i]['name'] +''; + + list += '\ + 日志跟踪 | ' + + '查看错误日志' + + ''; + + list += ''; + } + + if( rdata.data.length == 0 ){ + list = "当前没有数据"; + } + + var con = '
\ + \ +
\ +
\ + \ + \ + \ + \ + '+ list +'
名称操作
\ +
\ +
\ +
\ +
'; + + con += '
\ + 方便查看日志\ +
' + + $(".soft-man-con").html(con); + $('#databasePage').html(rdata.page); + }); +} +