首页 > 代码库 > 实用脚本 3 -- 进程查看脚本

实用脚本 3 -- 进程查看脚本

分享一个进程查看脚本(rlook),方便进程查看:

1、添加脚本,内容如下:

#!/bin/ksh

cd $HOME/bin

ps -u $LOGNAME|egrep " \
progress1| \            
progress2| \
progress3| \
" > $HOME/log/tmp.cs

clear
echo ""
echo "press <return> to check $LOGNAME system status\c"
read ANW
echo
I=`cat $HOME/log/tmp.cs | wc -l`
typeset -i I
echo "$LOGNAME system process : ( "$I" transaction-related processes running )"
I=0
S=`ps -fu$LOGNAME`
echo ‘+---- process name ---+---- number ---+---------- should be -----------+‘
P=`grep -c  progress1< $HOME/log/tmp.cs`
I=I+P
echo ‘|     progress1       |      ‘$P‘     |               1                |‘
P=`grep -c  progress2< $HOME/log/tmp.cs`
I=I+P
echo ‘|     progress2       |      ‘$P‘     |               1                |‘
P=`grep -c  progress3< $HOME/log/tmp.cs`
I=I+P
echo ‘|     progress3       |      ‘$P‘     |               3                |‘
echo ‘+---------------------+---------------+--------------------------------+‘
P=`ps -u$LOGNAME|wc -l`
typeset -i P
P=P-1
echo ‘|         total           |      ‘$I‘     |              11                |‘
echo ‘+---------------------+-------------+----------------------------------+‘
P=`grep -c defunc < $HOME/log/tmp.cs`
echo ‘|     <defunct>      |      ‘$P‘     |               0                |‘
echo ‘+---------------------+-------------+----------------------------------+‘
rm $HOME/log/tmp.cs

echo "press <return> to check $LOGNAME shmget status\c"
read ANW
echo "***************************************************************************"

ipcs -m | grep xxxxx

echo "***************************************************************************"
echo ""
echo "*************************************链路**********************************"

netstat -an | grep xxxxx

2、脚本添加可执行权限,在环境变量中配置脚本目录,方便实时可以运行此脚本O(∩_∩)O~