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