«   2021/02   »
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28            
02-28 20:18
Notice
Today
48
Total
1,406,573
관리 메뉴

변군이글루

[스크립트] 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
댓글쓰기 폼