# ! / Bin / the bash # receiving incoming external PID, optionally one # servicePid = $. 1 servicePid = `PS auxw | Sort -rn -K3 | head -2 | -n Sed ' 1P ' | awk ' {} Print $ 2 ' ` /alidata/jdk1.7.0_79/bin/jstack servicePid the -l $ {} >> jstack.out # View thread situation of the process, a high occupancy rate which threads investigation process, the top 10 servicePid =` ps - servicePid} -o $ {MP the THREAD, TID, Time | Sort -rn | head -n 10 | awk ' {}. 8 Print $ ' | -n Sed ' 2,10p ' | grep -v ' - ' ` for I in $ servicePid do the above mentioned idthe printf `= ' % X \ n- ' $ i` echo " Thread: $ i, 16 hexadecimal value: $ ID " DONE