1. 程式人生 > >【11】程序監控指令碼-getHandle.sh

【11】程序監控指令碼-getHandle.sh

# get size of java process handles

PName=$1
#echo $PName

   if [ "$PName" != "" ];then   
       a=`ps aux | grep $PName | grep -v grep | grep -v zabbix |awk '{print $2}'` 
       #echo $a
       arr=($a)
       handles=0
       count=0
       for PID in ${arr[@]}
       do          
          handle
=`sshpass -p admin12345 ssh -p 2343 -o StrictHostKeyChecking=no [email protected] "ls -l /proc/$PID/fd | wc -l"` handles=$(($handles+$handle)) done echo ${handle} fi