Process Memory usage.

#!/bin/sh

psidno=19230
prstat -s rss 1 1 |grep $psidno > /tmp/jav.txt
mems=`prstat -s rss 1 1 | grep $psidno |awk '{print $4}' | sed '$s/.$//'`

if [ $mems -gt 1024 ]; then
mailx -s " Process Memory usage status :" thamurali@yahoo.co.in < /tmp/jav.txt
fi

-----------------------------------------------
Above script will send a mail  if  a particular PID using morethan 1gb of memory.
Note : untested.

No comments: