Wednesday, August 26, 2009

Scheduling heap analysis

write a shell script dumpHeap.sh with this content:

export mypid=$(ps -efa|grep Dweblogic.Name=myservername |grep -v grep| awk -F " " '{print $2}')
echo PID=$mypid
jrcmd $mypid print_object_summary cutoff=0 > heapcontent$1.log


then schedule it this way:

echo "dumpHeap.sh 1" | at 20:00
echo "dumpHeap.sh 2" | at 21:00
echo "dumpHeap.sh 3" | at 22:00
echo "dumpHeap.sh 4" | at 23:00
echo "dumpHeap.sh 5" | at 00:00 tomorrow
echo "dumpHeap.sh 6" | at 01:00 tomorrow
echo "dumpHeap.sh 7" | at 02:00 tomorrow
echo "dumpHeap.sh 8" | at 03:00 tomorrow

No comments: