您现在的位置是:网站首页> 编程资料编程资料
shell脚本实现磁盘监控系统_linux shell_
2023-05-26
330人已围观
简介 shell脚本实现磁盘监控系统_linux 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 磁盘监控的资料请关注其它相关文章!
您可能感兴趣的文章:
相关内容
- 详解shell 函数定义与调用_linux shell_
- Linux 通过 autojump 命令减少 cd 命令的使用的实现方法_linux shell_
- shell 里 awk print 的用法详解_linux shell_
- shell脚本一键同时推送代码至github和gitee的解决办法_linux shell_
- 如何使用 Shell 脚本执行 .NET Core 应用_linux shell_
- shell脚本定时备份MySQL数据库数据并保留指定时间_linux shell_
- 浅谈Shell中的函数_linux shell_
- 详解shell 变量_linux shell_
- Linux文本查看命令及其选项详解(cat,head,tail)_linux shell_
- shell中如何批量注释和取消注释_linux shell_
