我想生成一個自動線程轉儲。這是我正在使用的腳本。使用jstack進行線程轉儲
THREADDUMP_LOG_FILE="/tmp/tmpLog_`date +"%Y%m%d%H%M%S"`"
pid=`ps axww | grep -v grep | sed -e 's/^[ ]*//g' | sed -e 's/[ ][ ]*/ /g' | cut -f1 -d' ' `
$JAVA_HOME/bin/jstack $pid >> $THREADDUMP_LOG_FILE
當我這樣做時,這就是我在線程轉儲日誌文件中看到的內容。
Usage:
jstack [-l] <pid>
(to connect to running process)
jstack -F [-m] [-l] <pid>
(to connect to a hung process)
jstack [-m] [-l] <executable> <core>
(to connect to a core file)
jstack [-m] [-l] [[email protected]]<remote server IP or hostname>
(to connect to a remote debug server)
Options:
-F to force a thread dump. Use when jstack <pid> does not respond (process is hung)
-m to print both java and native frames (mixed mode)
-l long listing. Prints additional information about locks
-h or -help to print this help message
顯然,我做錯了什麼。有人可以請指導我在這裏如何使用jstack採取線程轉儲?
是的,我同意。如果我必須在所有PID中執行此操作,那麼如何更改腳本? – rickygrimes