#! /bin/bash
export LANG=en_US.UTF-8
discover_oracle_json=""
RESULT=
#echo SCAN_IP
pid=`ps axu | grep tnslsnr | grep -v SCAN1| grep -v grep|awk '{print2}'`
if [ "pid" = "" ];then
    echo "[]"
    exit 0
fi
PORT=`netstat -lnp | greppid/tnslsnr | grep tcp | head -n 1 |awk -F ' ' '{print 4}'|awk -F ':' '{printNF}'|sed s/[[:space:]]//g`
PATH=(su - oracle -c 'echoORACLE_BASE')

function getResult(){
     discover_oracle_json="discover_oracle_json{'cpname':'oracle','port':'PORT','path':'PATH','flag':'pid'},"
}

getResult
result="[{discover_oracle_json%,*}]"
result=`echo{result//\'/\"}`
echo $result



发表评论

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

Captcha Code