tail -f /var/log/escenic/engine1-catalina.out > /tmp/threaddumps.log & for i in $(seq 1 10); do kill -QUIT `cat /var/run/escenic/engine1.pid`; sleep 1; done fg
- Starts logging Tomcat output to /tmp/threaddumps.log.
- Triggers 10 JVM thread dumps, spaced 1 second apart.
- Brings the logging process back to the foreground so you can stop it.
tail -f /var/log/escenic/engine1-catalina.out > /tmp/threaddumps.log &
tail -f
continuously follows (-f
) a log file, here:
/var/log/escenic/engine1-catalina.out
(Tomcat’s output log for Escenic Engine 1).> /tmp/threaddumps.log
redirects the live output into another file (/tmp/threaddumps.log
).- The trailing
&
sends that process to background, so it continues running while the shell remains usable.
Starts watching the log and recording everything into /tmp/threaddumps.log
in the background.
for i in $(seq 1 10); do kill -QUIT \cat /var/run/escenic/engine1.pid`; sleep 1; done`
This is a loop that runs 10 times. Let’s unpack it:
seq 1 10
→ generates numbers 1 through 10.cat /var/run/escenic/engine1.pid
→ reads the PID (process ID) of the running Escenic Engine.kill -QUIT <pid>
→ sends the QUIT signal (SIGQUIT
) to that Java process.
In Java, this tells the JVM to write a full thread dump to the standard output (i.e.,catalina.out
).sleep 1
→ waits one second between each signal.
It sends 10 SIGQUIT
signals (one per second) → 10 thread dumps will be written into the catalina log file, which is being captured by the first command.
fg
- Brings the background process (
tail -f
) back to the foreground. - This allows you to stop it later manually with
Ctrl+C
once you’re done collecting dumps
You can now watch the output live and stop it when you have enough thread dump data.