【发布时间】:2014-11-05 05:50:44
【问题描述】:
#!/bin/bash
for input in $(cat status_cpu.txt)
do
cpu=`ssh -i root@$input 'top -b -n1' | grep "load" | awk '{print $12}'`
max=2.02
if [ $(echo "$cpu < $max" | bc -l ) ]; then
echo "yes"
else
echo "no"
fi
done
猫状态_cpu.txt
10.0.0.1
10.0.0.2
我想在 shell 脚本中比较小数点。
【问题讨论】:
-
FWIW,使用
uptime比top更容易获得系统负载...