#! /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 '{print $2}'`
if [ "$pid" = "" ];then
    echo "[]"
    exit 0
fi
PORT=`netstat -lnp | grep $pid/tnslsnr | grep tcp | head -n 1 |awk -F ' ' '{print $4}'|awk -F ':' '{print $NF}'|sed s/[[:space:]]//g`
PATH=$(su - oracle -c 'echo $ORACLE_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