Bash script that reports the number of threads of a Java process
Jump to navigation
Jump to search
#!/bin/bash function java-process-pid() { ps -ef | grep "java \-jar.*threads\.jar" | grep -v "grep" | awk '{print $2}' } function thread-count() { pid=$1 cat /proc/${pid}/status | grep "^Threads" | awk '{print $2}' } pid=$(java-process-pid) thread-count ${pid}