首页 > 系统 > Linux > 正文

shell监控linux系统进程创建脚本分享

2019-10-26 18:37:58
字体:
来源:转载
供稿:网友

代码如下:
#!/bin/sh
while true
do
 ps ax -o command | sort | uniq > 1.txt
 usleep 100000
 ps ax -o command | sort | uniq > 2.txt
 diff  1.txt 2.txt | grep '^/+[^/+]' | while read a
 do
  a=`echo ${a#*+}`
  if [[ "$a" != "uniq" ]] && [[ "$a" != "sort" ]] && [[ "$a" != "" ]]
  then
   echo $a
  fi
 done
done

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表