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 ~