1 #!/bin/bash
 2 #Author:GaoHongYu
 3 #QQ:1061767621
 4 #Time:2019-12-24 18:43:22
 5 #Name:ncjk.sh
 6 #Version:V1.0
 7 clear
 8 xtip=$(ip a | grep "inet"|tail -1|cut -d " " -f 6)
 9 cprl=$(df -Th |head -2|tail -1|cut -d " " -f 10)
10 cpky=$(df -Th |head -2|tail -1|cut -d " " -f 12)
11 cpbfb=$(df -Th |head -2|tail -1|cut -d " " -f 18)
12 ncrl=$(free -m |head -2|tail -1|cut -d " " -f 13)
13 ncsy=$(free -m |head -2|tail -1|cut -d " " -f 22)
14 i=1
15 while [ $i -le 6 ];do
16    echo -e '\n' 
17    echo -e '\n' 
18    echo "-----磁盘监控系统-----"
19    echo "--作者:Mr_GaoHongYu--"
20    echo -n "监控本机IP地址:"$xtip
21    echo -e '\n'
22    echo "-----磁盘使用情况-----"
23    echo -n "系统磁盘总容量:"$cprl
24    echo -e '\n'
25    echo -n "当前磁盘可用容量:"$cpky
26    echo -e '\n'
27    echo -n "可用容量百分比:"$cpbfb
28    echo -e '\n'
29    echo "-----内存使用情况-----"
30    echo -n "内存总容量:"$ncrl
31    echo -e '\n'
32    echo -n "内存已使用:"$ncsy
33    echo -n "内存已用百分比:"
34    echo $((ncrl/ncsy))'%'
35         sleep 6
36     let i++
37 done

效果如图:

版权声明:本文为gaohongyu原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/gaohongyu/p/12093437.html