Skip to content

Instantly share code, notes, and snippets.

@asafmaoz1234
Created December 12, 2018 11:51
Show Gist options
  • Save asafmaoz1234/56a514155f4263270f45fe12c3608914 to your computer and use it in GitHub Desktop.
Save asafmaoz1234/56a514155f4263270f45fe12c3608914 to your computer and use it in GitHub Desktop.
Generate thread dumps
java_pid="$(pgrep -f java)"
echo "java process id: $java_pid"
if [ "$java_pid" ]
then
mkdir thread_dumps
jstack -l $java_pid >> thread_dumps/threaddumps_0.log
echo "created a file: threaddumps_0.log"
for i in {1..10}
do
sleep 60s
jstack -l $java_pid >> thread_dumps/threaddumps_$i.log
echo "created a file: $i"
done
else
echo "java pid is empty"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment