Created
November 9, 2011 01:16
-
-
Save fabrizioc1/1349992 to your computer and use it in GitHub Desktop.
Script to trigger java dump when WebSphere JVM does a full GC
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 | |
# | |
# Run this in the background and keep it running when you log out run it like this: | |
# nohup /tmp/trigger_javadump.sh >/tmp/trigger_javadump.log 2>&1 & | |
# | |
FULLGC_PATTERN='^Application time: 0.0000' | |
VERBOSEGC_PATH='verbosegc.log' | |
while true; do | |
FULLGC_FOUND=$(grep "$FULLGC_PATTERN" "$VERBOSEGC_PATH") | |
if [ "$FULLGC_FOUND" ]; then | |
echo "Full GC found" | |
# Generate thread dump on all WebSphere instances running | |
for pid in $(pgrep -f WebSphere); do | |
kill -3 $pid | |
done | |
exit 0 | |
fi | |
sleep 1 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment