[shell] thread dump
2021. 3. 25. 17:25
반응형
WAS thread dump Script
```
#!/bin/bash
export pidlist=`ps -ef | grep tomcat.server | awk '{print $2}'`
date=`date + %m%d`
export LOG_DIR=/app/logs/threaddump/$date
echo "LOG_DIR = " $LOG_DIR
if [! -d $LOG_DIR ]; then
mkdir $LOG_DIR
fi
echo "LOG_DIR making success!! "
nowtime=`date +%H:%M`
echo "nowdate=" $nowtime
ps -ef | grep tomcat.server | awk '{print $2,$9}' >> /app/logs/threaddump/$date/pidname.txt
echo "thread dump start....."
for PID in $pidlist ;do
/app/jdk/jdk1.8.0_89/bin/jstack -1 $PID >> /app/logs/threaddump/$date/${PID}_ThreadDump-1.log
echo "first thread dump ....."
done
sleep 3
echo "first thread dump success....."
for PID in $pidlist ;do
/app/jdk/jdk1.8.0_89/bin/jstack -1 $PID >> /app/logs/threaddump/$date/${PID}_ThreadDump-2.log
echo "second thread dump ....."
done
sleep 3
echo "second thread dump success....."
for PID in $pidlist ;do
/app/jdk/jdk1.8.0_89/bin/jstack -1 $PID >> /app/logs/threaddump/$date/${PID}_ThreadDump-3.log
echo "third thread dump ....."
done
sleep 3
echo "third thread dump success....."
```
반응형
'Infra > Linux' 카테고리의 다른 글
[Linux] 서버 용량 확인 (0) | 2021.03.29 |
---|---|
[Linux] 리눅스 명령어 (0) | 2021.03.25 |
[Linux] war 압축 (0) | 2014.01.24 |
[Linux] vi 명령어 (0) | 2014.01.24 |