Created
August 22, 2013 13:48
-
-
Save code6/6307385 to your computer and use it in GitHub Desktop.
dump hive process jstack
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ $# -eq 0 ]; then | |
echo "Usage: dump_sw_java.sh <keyword>" | |
fi | |
DUMPDIR=dump_dir | |
keyword=$1 | |
ts=$(date +%H%M%S.%N) | |
for pid in `ps aux | grep python | grep $keyword | awk '{ print $2}'`; do | |
echo $pid | |
pstree -p $pid > $DUMPDIR/pstree.$keyword.$pid.$ts | |
javapid=$(pstree -p $pid | grep 'java(' | egrep -o 'java\([[:digit:]]+' | cut -d'(' -f 2) | |
if [[ $javapid =~ "^[0-9]+$" ]]; then | |
/usr/local/java/bin/jstack -l $javapid > $DUMPDIR/jstack.$keyword.$pid.$javapid.$ts | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment