輸入java過程的jstack信息示例分享 經由過程線程客棧信息剖析java線程。本站提示廣大學習愛好者:(輸入java過程的jstack信息示例分享 經由過程線程客棧信息剖析java線程)文章只能為提供參考,不一定能成為您想要的結果。以下是輸入java過程的jstack信息示例分享 經由過程線程客棧信息剖析java線程正文
#!/bin/sh
pro_name=java #process name
keys=`ps -ef |grep "$pro_name" |grep -v "grep" | awk '{print $2}'`
nowdate=`date +%Y%m%d%H%M%S`
jstackpath="/usr/java/jdk1.6.0_07/bin/jstack"
cpulogpath="/home/"
for key in ${keys}
do
cpulogpath_file="${cpulogpath}cpu_${nowdate}${key}.log"
cpustackCmd="${jstackpath} -l ${key} >${cpulogpath_file}"
echo "command: ${cpustackCmd}"
eval $cpustackCmd
done