shell脚本输出所有java进程的gc状态
#!/bin/sh
#read -t 30 -p "请输入jstat命令监控间隔,次数:" time count
read -p "输入jstat命令监控间隔(1s输出一次,输入1000):" time
if [ -z "$time" ];then
time=1000
fi
read -p "输入jstat命令监控次数:" count
if [ -z "$count" ];then
count=10
fi
for javaid in `ps -ef|grep java|grep 'Xms' |awk '{print $2}'`
do
echo 当前java pid=$javaid
echo 当前应用 `ps -ef|grep "$javaid"`
jstat -gcutil "$javaid" $time $count
done
本文来自博客园,作者:up~up,转载请注明原文链接:https://www.cnblogs.com/soft-engineer/articles/15127062.html
浙公网安备 33010602011771号