# get size of java process VIRT memory 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) virtAll=0 count=0 for PID in ${arr[@]} do virt=`pidstat -r -p $PID 3 1 | awk 'NR==4{print $6}'` virt=$virt*1024 virtAll=$(($virtAll+$virt)) done echo ${virtAll} fi