Skip to content

Instantly share code, notes, and snippets.

@azinneera
Last active November 4, 2021 10:15
Show Gist options
  • Save azinneera/419d9f6507aeed17a9a4de92cc999ca9 to your computer and use it in GitHub Desktop.
Save azinneera/419d9f6507aeed17a9a4de92cc999ca9 to your computer and use it in GitHub Desktop.
Windows .bat file to generate thread dumps for java process
REM This batch script generates a given number of thread dumps at a given interval in seconds
REM To generate 4 thread dumps at 15s intervals for the java process with id 1234
REM execute the script as
REM threaddump-jstack.bat 1234 4 15
for /L %%i in (1,1,%2) do (
echo Taking Thread Dump %%i
jstack -l %1 > thread-dump-%%i.txt
timeout %3
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment