#! /bin/bash
export LANG=en_US.UTF-8

pids=`ps aux | grep rabbitmq | grep beam | grep -v org.apache.catalina.startup.Bootstrap | awk '{print 2}'`
discover_mq_json=""

for pid inpids
do
    target_jar_file=`ps aux | grep pid|grep -v grep |grep -v notty |awk '{print(NF-7)}'|sed 's/\"//g'`
    pwd=
    if [ -e "target_jar_file" ];then
        bin_path=`dirname "target_jar_file"`
        cd bin_path/../../../../
        pwd=(echo `pwd`)
    fi
    file_path=`ps aux | grep pid|grep -v grep |grep -v notty |awk '{print(NF-7)}'|sed 's/\"//g'`
    p_path=`dirname "file_path"`
    cdp_path/../../../../sbin
    port=`./rabbitmqctl status | grep listeners |sed 's/.*amqp,//g' | awk -F ',' '{print 1}'`
    discover_mq_json="discover_mq_json{'cpname':'rabbitmq','port':'port','path':'pwd','pid':'pid'},"

done
result="[{discover_mq_json%,*}]"
result=`echo {result//\'/\"}`
echoresult

发表评论

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

Captcha Code