while [ 1 ]
do
    clear
    ps aux | grep xmirror | grep -v grep
    mem=0
    for data in `ps aux | grep xxxx | grep -v grep | awk '{print $4}'`
    do
      mem=`echo $mem + $data | bc`
    done
    echo `date +%F" "%H:%M:%S`
    echo mem:{$mem}

   # if [ $mem -gt 2 ] 
    if (echo ${mem} 2 | awk '!($1>$2){exit 1}')
    then
    #  echo `date +%F" "%H:%M:%S`":"$mem
       echo `date +%F" "%H:%M:%S`" mem: "$mem
       echo `date +%F" "%H:%M:%S`" mem: "$mem >> /home/jll/Desktop/jll.log
       sleep 2
    fi
     sleep 2
done
~      


   

 

 
posted on 2018-06-24 18:09  jxba  阅读(218)  评论(0编辑  收藏  举报