shell脚本实现磁盘监控系统
更新时间:2020年09月27日 08:38:55 作者:高宏宇
这篇文章主要介绍了shell脚本实现磁盘监控系统,帮助大家更好的利用shell脚本管理数据,感兴趣的朋友可以了解下
利用shell脚本实现每隔60秒磁盘内存数据监控
#!/bin/bash #Author:GaoHongYu #QQ:1061767621 #Time:2019-12-24 18:43:22 #Name:ncjk.sh #Version:V1.0 clear xtip=$(hostname -I) cprl=$(df -Th |head -2|tail -1|cut -d " " -f 10) cpky=$(df -Th |head -2|tail -1|cut -d " " -f 12) cpbfb=$(df -Th |head -2|tail -1|cut -d " " -f 18) ncrl=$(free -m |head -2|tail -1|cut -d " " -f 13) ncsy=$(free -m |head -2|tail -1|cut -d " " -f 22)BC=$(echo "scale=2;$ncsy/$ncrl*100" |bc|cut -d "." -f 1) i=1 while [ $i -le 60 ];do echo -e '\n' echo -e '\n' echo "-----磁盘监控系统-----" echo "--作者:Mr_GaoHongYu--" echo -n "监控本机IP地址:"$xtip echo -e '\n' echo "-----磁盘使用情况-----" echo -n "系统磁盘总容量:"$cprl echo -e '\n' echo -n "当前磁盘可用容量:"$cpky echo -e '\n' echo -n "可用容量百分比:"$cpbfb echo -e '\n' echo "-----内存使用情况-----" echo -n "内存总容量:"$ncrl echo -e '\n' echo -n "内存已使用:"$ncsy echo -e '\n' echo -n "内存已用百分比:" echo "$BC%" sleep 60 let i++ done
效果如图:
以上就是shell脚本实现磁盘监控系统的详细内容,更多关于shell 磁盘监控的资料请关注脚本之家其它相关文章!
相关文章
浅谈linux中shell变量$#,$@,$0,$1,$2的含义解释
下面小编就为大家带来一篇浅谈linux中shell变量$#,$@,$0,$1,$2的含义解释。小编觉得挺不错的,现在就分享给大家,也给大家做个参考。一起跟随小编过来看看吧2017-03-03Idea使用Bashsupport插件编辑Shell脚本的方法
这篇文章主要介绍了Idea插件之——Bashsupport编辑Shell脚本的相关知识,功能非常齐全有检查错误并且还可以在idea中直接运行shell脚本,本教程带领大家一步步演示插件的安装和配置,需要的朋友可以参考下2021-05-05Shell脚本配合iptables屏蔽来自某个国家的IP访问
这篇文章主要介绍了Shell脚本配合iptables屏蔽来自某个国家的IP访问,本文利用IPdeny的IP数据,然后用Shell脚本导入iptables实现屏蔽IP访问,需要的朋友可以参考下2015-04-04
最新评论