php状态判断来获取运行信息

pull/113/head
midoks 3 years ago
parent 905a3a90fb
commit adacc075ca
  1. 6
      plugins/php/index.py
  2. 8
      plugins/php/js/php.js
  3. 3
      scripts/init.d/mw.tpl

@ -537,6 +537,10 @@ def checkFpmStatusFile(version):
def getFpmStatus(version): def getFpmStatus(version):
checkFpmStatusFile(version) checkFpmStatusFile(version)
stat = status(version)
if stat == 'stop':
return mw.returnJson(False, 'PHP[' + version + ']未启动!!!')
try: try:
url = 'http://' + mw.getHostAddr() + '/phpfpm_status_' + version + '?json' url = 'http://' + mw.getHostAddr() + '/phpfpm_status_' + version + '?json'
result = mw.httpGet(url) result = mw.httpGet(url)
@ -552,7 +556,7 @@ def getFpmStatus(version):
except Exception as e: except Exception as e:
data = {} data = {}
return mw.getJson(data) return mw.returnJson(True, "OK", data)
def getDisableFunc(version): def getDisableFunc(version):

@ -312,7 +312,13 @@ function setFpmConfig(version){
function getFpmStatus(version){ function getFpmStatus(version){
phpPost('get_fpm_status', version, '', function(ret_data){ phpPost('get_fpm_status', version, '', function(ret_data){
var rdata = $.parseJSON(ret_data.data); var tmp_data = $.parseJSON(ret_data.data);
if(!tmp_data.status){
layer.msg(tmp_data.msg, { icon: tmp_data.status ? 1 : 2 });
return;
}
var rdata = tmp_data.data;
var con = "<div style='height:420px;overflow:hidden;'><table class='table table-hover table-bordered GetPHPStatus' style='margin:0;padding:0'>\ var con = "<div style='height:420px;overflow:hidden;'><table class='table table-hover table-bordered GetPHPStatus' style='margin:0;padding:0'>\
<tr><th>应用池(pool)</th><td>" + rdata.pool + "</td></tr>\ <tr><th>应用池(pool)</th><td>" + rdata.pool + "</td></tr>\
<tr><th>进程管理方式(process manager)</th><td>" + ((rdata['process manager'] == 'dynamic') ? '' : '') + "</td></tr>\ <tr><th>进程管理方式(process manager)</th><td>" + ((rdata['process manager'] == 'dynamic') ? '' : '') + "</td></tr>\

@ -184,6 +184,9 @@ case "$1" in
'restart_panel') 'restart_panel')
mw_stop_panel mw_stop_panel
mw_start_panel;; mw_start_panel;;
'restart_task')
mw_stop_task
mw_start_task;;
'status') mw_status;; 'status') mw_status;;
'logs') error_logs;; 'logs') error_logs;;
'default') 'default')

Loading…
Cancel
Save