本站教程收集整理的这篇文章主要介绍了统计linux不同运行状态的进程个数及进程名,本站教程本站觉得挺不错的,现在分享给大家,也给大家做个参考。
下面是编程之家 code.cc 通过网络收集整理的代码片段。
编程之家小编现在分享给大家,也给大家做个参考。
#! /bin/sh IFS_old=$IFS IFS=$'\n' file="zombie.txt" num=0 proc_name= self="cnt_zombie.sh" while test true do if [ $1 = "arm" ] then list="`ps -w|grep $2|grep -v grep|grep -v $self`" elif [ $1 = "pc" ] then list="`ps axu|grep -w $2|grep -v grep|grep -v $self`" fi if [ "x$list" != "x" ] then x= #echo "list: $list" #num=`echo $list|wc -l` #echo "num: $num" else conTinue fi if [ $1 = "pc" ] then 便宜香港vps pos=`ps axu|grep PID|grep -bo COMMAND|cut -d ":" -f 1` elif [ $1 = "arm" ] then pos=26 fi num=0 for line in $list do num=$[$num+1] if [ -n $proc_name ] then proc_name="$proc_name\n\t`echo $line|cut -c $pos- `" else proc_name="`echo $line|cut -c $pos- `" fi done echo -e "process conut: $num,process list:$proc_name\n" >> $file sleep 3 done
本站总结
以上是本站教程为你收集整理的统计linux不同运行状态的进程个数及进程名全部内容,希望文章能够帮你解决统计linux不同运行状态的进程个数及进程名所遇到的程序开发问题。
如果觉得本站教程网站内容还不错,欢迎将本站教程推荐给好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。