[root@numberone ~]# pcpu= `ps aux | sort -k 3 -r | head -n 2 | tail -n 1 |awk ‘{print $3}’[root@numberone ~]# echo $pcpu`99.7[root@numberone ~]# echo $pcpu / 4 | bc24[root@numberone ~]# top -n 1 |grep “^KiB Mem” | awk '{print KaTeX parse error: Expected 'EOF', got '}' at position 2: 6}̲'` `3113076` `[…(top -n 1 | grep ^%Cpu | awk ‘{print int ($8)}’)
if [ c p u − l t 75 ] ; t h e n p c p u = cpu -lt 75 ]; then pcpu=cpu−lt75];thenpcpu=(ps aux | sort -k 3 -r | head -n 2 | tail -n 1 | awk '{print KaTeX parse error: Expected 'EOF', got '}' at position 2: 3}̲') ppcp…(echo p c p u / 4 ∣ b c ) p i d = pcpu / 4 | bc) pid=pcpu/4∣bc)pid=(ps aux | sort -k 3 -r | head -n 2 | tail -n 1 | awk ‘{print $2}’)
echo “CPU is lower, $pid consume $ppcpu%”
else
echo “CPU is OK”
fi