변군이글루

[스크립트] thread dump && heap dump 본문

문___스크립트

[스크립트] thread dump && heap dump

변군 변군이글루 2016.11.26 12:23

 

# cat TH_dump.sh

#/bin/bash

 

PID=`ps -ef | grep java | awk '{print $2}'`

 

#####thread dump

#ps -ef | grep java| awk '{print $2}' | xargs kill -3

 

echo "Starting Thread Dump..."

        for(( i=0; i<3; i++)) ;

        do

        cp /app/tomcat/catalina/logs/`date +%Y%m%d`.log /app/tomcat/catalina/logs/threaddump_`date +%Y%m%d_%H%M%S`.log

        echo "$ i  threaddump is successed"

        sleep 3

done

 

#####java heap dump

echo "Starting Heap Dump..."

/usr/bin/jmap -dump:file=/root/heap_`date +%Y%m%d_%H%M%S`.dump $PID

 

0 Comments
댓글쓰기 폼