vim gen_fen_qu_shi_yong_lv.sh
chmod 755 gen_fen_qu_shi_yong_lv.sh
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | #!/bin/bash # 统计根分区使用率 # Author:Jame 2016-10-14 fenquname= /dev/sda1 # 输出第5行再以%为分隔符输出第1行 rate=$( df -h| grep $fenquname | awk '{print $5}' | cut -d "%" -f1) if [ $rate - ge 10 ] then echo "Waring! $fenquname is full!!" else echo "rate is $rate" fi |