#!/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