废话不多说先上脚本
这个脚本自己原创写的,命令集成了各位运维人事经常find error的cpu占有的问题困扰
先上脚本
#!/bin/bashlfq666
read -p "please input number to choose what the progress cannot run reason 1:top; 2:top -p pid; 3:ps -mp pid -o THREAD,tid,time;4:ps -mp pid -o THREAD,tid,time | sort -rn;5:exchange pidtotid printf %x\n pid;6:jstack pid |grep tid -a 100 " b
n1=$(echo $b|sed 's/[0-9]//g')
if [ -n "$n1" ]
then
echo "please enter pid number"
exit
fi
case $b in lfq666
1)
top
;;
2)
read -p "what the progress pid" c
n1=$(echo $c|sed 's/[0-9]//g')
if [ -n "$n1" ]
then
echo "please enter pid number"
exit
fi
top -p $c
;;
3)
read -p "what the progress pid" c
n1=$(echo $c|sed 's/[0-9]//g')
if [ -n "$n1" ]
then
echo "please enter pid number"
exit
fi
ps -mp $c -o THREAD,tid,time
;;
4)
read -p "what the progress pid" c
n1=$(echo $c|sed 's/[0-9]//g')
if [ -n "$n1" ]
then
echo "please enter pid number"
exit
fi
ps -mp $c -o THREAD,tid,time | sort -rn
;;
5)
read -p "what the progress pid" c
n1=$(echo $c|sed 's/[0-9]//g')
if [ -n "$n1" ]
then
echo "please enter pid number"
exit
fi
printf "%x\n" $c
;;
6)
read -p "what the progress pid" c1
n1=$(echo $c1|sed 's/[0-9]//g')
if [ -n "$n1" ]
then
echo "please enter pid number"
exit
fi
read -p "what the progress tid" c
n1=$(echo $c|sed 's/[0-9]//g')
if [ -n "$n1" ]
then
echo "please enter tid number"
exit
fi
cd /java/bin
jstack pid |grep tid -a 100
;;
*)
echo "please amount 1-4 number"
;;
esac
1
2
3
4
5
6
这个命令确认过安装完成还是有些问题安装教程看上一个文章
jstack pid |grep tid -a 100