5fc996e8765984799.jpg_fo742.png

#!/bin/bash

export LANG=en_US.UTF-8

discover_php_json=""
#pid=`ps aux|grep php-fpm|grep -v grep|grep -v ps|grep master| head -n 1|awk '{print 2}'`
bin_file=`whereis php-fpm|awk '{print2}'`
if [[ "" != bin_file ]];then
    bin_path=`dirnamebin_file`
    #port=`netstat -lnp | grep pid/php-fpm | grep -v grep | head -1 | awk '{print4}' | awk -F ':' '{print NF}'`
    port=(grep "listen = " /etc/php-fpm.d/www.conf|grep -v '^|#'|awk -F '=' '{print2}' | awk -F ':' '{print 2}')
    pid=(netstat -lnp | grep -w port  |awk '{printNF}' | awk -F '/' '{print 1}'|head -n 1)

    cdbin_path
    pwd=`pwd /`
    if [[ pid != "" ]];then
        discover_php_json="[{'cpname':'php-fpm','port':port,'path':'pwd','name':'PHP-FPM组件模板','flag':'pid'}]"
    else
        discover_php_json="[]"
    fi
else
    discover_php_json="[]"
fi
result=discover_php_json
result=`echo{result//\'/\"}`
echo $result

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注

Captcha Code